home *** CD-ROM | disk | FTP | other *** search
/ GFX Sensations 1 / Graphic Sensations - Volume 1.iso / tools / amiga / 3d_tools / irit40s.lha / Irit / docs / irit.src (.txt) < prev    next >
Encoding:
LaTeX Document  |  1994-01-05  |  193.1 KB  |  4,753 lines

  1. ;This is the source file to create documentation for the IRIT solid modeler.
  2. ;First character in line specifies the action to take for this line/next block
  3. ;as follows:
  4. ; ';' - a comment that is always ignored.
  5. ; '#' - all lines following this line until next '#' are indented as an array.
  6. ;       Four integers follow specifying indentations, # of elements per
  7. ;       line, whether or not to put an internal vertical separator, and
  8. ;       if entries are row ordered (1) or column ordered (2).
  9. ; '@' - latex only manual. Latex commands can appear within this line.
  10. ; '!' - plain text and irit docs only manual - keywords/headers.
  11. ; '&' - plain text only manual - headers.
  12. ; '$' - terminator for current block.
  13. ; '*' - prints line in all modes but without any latex filtering on the line.
  14. ; '%' - copied verbatim to all output types.
  15. ; latex commands can appear in regular text limited to a single line as
  16. ; {\command *}. For plain text the {\command } will be filtered out.
  17. ; Escaped characters via '\' (i.e. \#) will be left escaped (\#) in the
  18. ; latex output but unescaped (#) in the plain output.
  19. ;                       IRIT solid modeler (C) Gershon Elber 1991.
  20. @% Irit Solid modeler latex manual.
  21. @% Authors:     Gershon Elber
  22. @% Date:        Thu April 15, 1993
  23. @% Copyright (c) 1991/92/93 Gershon Elber
  24. @\documentstyle[11pt]{article}
  25. @\oddsidemargin  -.2in
  26. @\evensidemargin -.2in
  27. @\textwidth 6.75in
  28. @\topmargin -.5in
  29. @\textheight 9.5in
  30. @\newcommand{\eqnref}[1]{(\ref{#1})}
  31. @\begin{document}
  32. @\pagestyle{empty}
  33. @   \rule{0in}{3in}
  34. @   \begin{center}
  35. @       {\huge\bf IRIT 4.0 User's Manual}\\
  36. @       \vspace{3cm}
  37. @       {\Large A Solid modeling Program}\\
  38. @       \vspace{2cm}
  39. @       {\large Copyright (C) 1989, 1990, 1991, 1992, 1993 Gershon Elber}\\
  40. @       \vspace{1cm}
  41. @       {\large EMail: gershon@cs.technion.ac.il }\\
  42. @       \vspace{2cm}
  43. @       {\large Join {\em IRIT} mailing list: gershon@cs.technion.ac.il }\\
  44. @       {\large Mailing list: irit-mail@cs.technion.ac.il }\\
  45. @       {\large Bug reports: irit-bugs@cs.technion.ac.il }\\
  46. @       \vfill
  47. @       {\small This manual is for IRIT version 4.0.}
  48. @   \end{center}
  49. @\newpage
  50. @\tableofcontents
  51. @\newpage
  52. @\setcounter{page}{1}
  53. @\markright{{\em {\bf Irit Solid modeler}}\hfil G. Elber}
  54. @\pagestyle{myheadings}
  55. @\newpage
  56. @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  57. @\section{Introduction}
  58. !INTRODUCTION
  59.    {\em IRIT} is a solid modeler developed for educational purposes. Although
  60.  small, it is now powerful enough to create quite complex scenes.
  61.    {\em IRIT} started as a polygonal solid modeler and was originally developed
  62.  on an IBM PC under MSDOS. Version 2.0 was also ported to X11 and version 3.0
  63.  to SGI 4D systems. Version 3.0 also includes quite a few free form curves
  64.  and surfaces tools. See the UPDATE.NEW file for more detailed update
  65.  information. In Version 4.0, the display devices were enhanced, freeform
  66.  curves and surfaces have further support, functions can be defined, and
  67.  numerous improvement and optimizations are added.
  68. @\section{Copyrights}
  69. !COPYRIGHTS
  70.    BECAUSE {\em IRIT} AND ITS SUPPORTING TOOLS AS DOCUMENTED IN THIS DOCUMENT
  71.  ARE LICENSED FREE OF CHARGE, I PROVIDE ABSOLUTELY NO WARRANTY, TO THE EXTENT
  72.  PERMITTED BY APPLICABLE STATE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING, I
  73.  GERSHON ELBER PROVIDE THE {\em IRIT} PROGRAM AND ITS SUPPORTING TOOLS "AS IS"
  74.  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
  75.  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  76.  PARTICULAR PURPOSE.
  77.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THESE PROGRAMS IS WITH
  78.  YOU. SHOULD THE {\em IRIT} PROGRAMS PROVE DEFECTIVE, YOU ASSUME THE COST OF
  79.  ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  80.    IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL GERSHON ELBER,
  81.  BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES,
  82.  OR OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
  83.  USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR A
  84.  FAILURE OF THE PROGRAMS TO OPERATE WITH PROGRAMS NOT DISTRIBUTED BY GERSHON
  85.  ELBER) THE PROGRAMS, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF
  86.  SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
  87. @\smallskip
  88.    {\em IRIT} is a freeware solid modeler. It is not public domain since I
  89.  hold copyrights on it. However, unless you are to sell or attempt to make
  90.  money from any part of this code and/or any model you made with this solid
  91.  modeler, you are free to make anything you want with it.
  92.    {\em IRIT} can be compiled and executed on numerous Unix systems as well
  93.  as OS2, Windows NT and AmigaDOS. However, beware the MSDOS support is fading
  94.  away.
  95.    You are not obligated to me or to anyone else in any way by using {\em IRIT}.
  96.    You are encouraged to share any model you made with it, but the models
  97.  you made with it are {\em yours}, and you have no obligation to share them.
  98.    You can use this program and/or any model created with it for non
  99.  commercial and non profit purposes only. An acknowledgement on the way the
  100.  models were created would be nice but is {\em not} required.
  101. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  102. @\section{Command Line Options and Set Up of {\em IRIT}}
  103. !SETUP
  104.    The {\em IRIT} program reads a file called {\bf irit.cfg} each time it is executed.
  105.    This file configures the system. It is a regular text file with comments, so
  106.  you can edit it and properly modify it for your environment.
  107.    This file is being searched for in the directory specified by the
  108.  IRIT\_PATH environment variable.
  109.    For example 'setenv IRIT\_PATH /u/gershon/irit/bin/'.
  110.    Note IRIT\_PATH must terminate with '/'. If the variable is not set only
  111.  the current directory is being searched for {\bf irit.cfg}.
  112.    In addition, if it exists, a file by the name of {\bf iritinit.irt} will be
  113.  automatically executed before any other '.irt' file. This file may contain
  114.  any {\em IRIT} command. It is the proper place to put your predefined
  115.  functions and procedures if you have some.
  116.    This file will be searched much the same way {\bf IRIT.CFG} is. The
  117.  name of this initialization file may be changed by setting the StartFile
  118.  entry in the configuration file.
  119.    This file is far more important starting at version 4.0, because of the new
  120.  function and procedure definition that has been added, and which is used
  121.  to emulate BEEP, VIEW, and INTERACT for example.
  122.    The solid modeler can be executed in text mode (see the .cfg and the -t
  123.  flag below) on virtually any system with a C compiler.
  124.   Under all systems the following environment variables must be set
  125.  and updated:
  126. # 14 2 0 1
  127.  path
  128.   Add to path the directory where {\em IRIT}'s binaries are.
  129.  IRIT\_PATH
  130.   Directory with config., help and {\em IRIT}'s binary files.
  131.  IRIT\_DISPLAY
  132.   The graphics driver program/options. Must be in path.
  133.  IRIT\_BIN\_IPC
  134.   If set, uses binary Inter Process Communication.
  135.  For example,
  136. @\begin{verbatim}
  137.    set path = ($path /u/gershon/irit/bin)
  138.    setenv IRIT_PATH  /u/gershon/irit/bin/
  139.    setenv IRIT_DISPLAY "xgldrvs -s-"
  140.    setenv IRIT_BIN_IPC 1
  141. @\end{verbatim}
  142.  to set /u/gershon/irit/bin as the binary directory and to use the sgi's
  143.  gl driver. If IRIT\_DISPLAY is not set, the server (i.e., the {\em IRIT}
  144.  program) will prompt and wait for you to run a client (i.e., a display
  145.  driver). if IRIT\_PATH is not set, none of the configuration files, nor
  146.  the help file will be found.
  147.  If IRIT\_BIN\_IPC is not set, text based IPC is used, which is far
  148.  slower. No real reason not to use IRIT\_BIN\_IPC, unless it does not
  149.  work for you.
  150.   In addition, the following optional environment variables may be set.
  151. # 17 2 0 1
  152.  IRIT\_MALLOC
  153.   If set, apply dynamic memory consistency testing.
  154.   Programs will execute much slower in this mode.
  155.  IRIT\_DEBUG\_FUNC
  156.   prints debugging information on user's defined
  157.   functions. If >0, invocation and leaving of functions.
  158.   If >2, parameters and returned values as well. If >4
  159.   global variable list is printed as well on invocation.
  160.  IRIT\_SERVER\_HOST
  161.   Internet Name of IRIT server (used by graphics driver).
  162.  IRIT\_SERVER\_PORT
  163.   Set a different socket port number than the default.
  164.  For example,
  165. @\begin{verbatim}
  166.    setenv IRIT_MALLOC 1
  167.    setenv IRIT_SERVER_HOST irit.cs.technion.ac.il
  168.    setenv IRIT_SERVER_PORT 5432
  169. @\end{verbatim}
  170.  IRIT\_MALLOC is useful for programmers, or when reporting a memory
  171.  fatal error occurrence. The IRIT\_SERVER\_HOST/PORT controls the
  172.  server/client ({\em IRIT}/Display device) communication.
  173.  IRIT\_SERVER\_HOST and IRIT\_SERVER\_PORT are used in the unix and
  174.  Window NT ports of {\em IRIT}.
  175.    See the section on the graphics drivers for more details.
  176.    A session can be logged into a file as set via LogFile in the configuration
  177.  file. See also the LOGFILE command.
  178.    The following command line options are available:
  179. @\begin{verbatim}
  180.    IRIT [-t] [-z] [file.irt]
  181. @\end{verbatim}
  182. # 10 2 1 1
  183.    Puts {\em IRIT} into text mode. No graphics will be displayed and
  184.    the display commands will be ignored. Useful when one needs to
  185.    execute an irt file to create data on a tty device...
  186.    Prints usage message and current configuration/version
  187.    information.
  188.  file.irt
  189.    A file to invoke directly instead of waiting to input from
  190.    stdin.
  191. @\subsection{IBM PC OS2 Specific Set Up}
  192.  Under OS2 the IRIT\_DISPLAY environment variable must be set (if set) to
  193.  os2drvs.exe without any option (-s- will be passed automatically).
  194.  os2drvs.exe must be in a directory that is in the PATH environment
  195.  variable. IRIT\_POS can be set to the X1 Y1 X2 Y2 dimensions of the
  196.  window. IRIT\_BIN\_IPC can be used to signal binary IPC which is faster.
  197.  Here is a complete example:
  198. @\begin{verbatim}
  199. %set IRIT_PATH=c:\irit\bin\
  200.  set IRIT_DISPLAY=os2drvs.exe
  201.  set IRIT_POS=230 120 550 460
  202.  set IRIT_BIN_IPC=1
  203. @\end{verbatim}
  204.  assuming the directory specified by IRIT\_PATH holds the executables of
  205.  IRIT and is in PATH.
  206.  If IRIT\_BIN\_IPC is not set, text based IPC is used which is far
  207.  slower. No real reason not to use IRIT\_BIN\_IPC unless it does not
  208.  work for you.
  209. @\subsection{IBM PC Window NT Specific Set Up}
  210.  The NT port uses sockets and is, in this respect, similar to the unix port.
  211.  The envirnoment variables IRIT\_DISPLAY, IRIT\_SERVER\_HOST,
  212.  IRIT\_SERVER\_PORT, and IRIT\_BIN\_IPC should all be set in a similar
  213.  way to the Unix specific setup. As a direct result, the server (IRIT)
  214.  and the display device may be running on different hosts. For example
  215.  the server might be running on an NT system while the display device
  216.  will be running on an SGI4D exploiting the graphic's hardware
  217.  capabilities.
  218. @\subsection{Unix Specific Set Up}
  219.    Under UNIX using X11 (x11drvs driver) add the following options to
  220.  your .Xdefaults. Most are self explanatory. The Trans attributes control
  221.  the transformation window, while the View attributes control the view window.
  222.  SubWin attributes control the subwindows within the Transformation window.
  223. # 33 2 0 1
  224.  \#if COLOR
  225.  irit*Trans*BackGround:
  226.   NavyBlue
  227.  irit*Trans*BorderColor:
  228.   Red
  229.  irit*Trans*BorderWidth:
  230.  irit*Trans*TextColor:
  231.   Yellow
  232.  irit*Trans*SubWin*BackGround:
  233.   DarkGreen
  234.  irit*Trans*SubWin*BorderColor:
  235.   Magenta
  236.  irit*Trans*Geometry:
  237.   =150x500+500+0
  238.  irit*Trans*CursorColor:
  239.   Green
  240.  irit*View*BackGround:
  241.   NavyBlue
  242.  irit*View*BorderColor:
  243.   Red
  244.  irit*View*BorderWidth:
  245.  irit*View*Geometry:
  246.   =500x500+0+0
  247.  irit*View*CursorColor:
  248.   Red
  249.  irit*MaxColors:
  250.  \#else
  251.  irit*Trans*Geometry:
  252.   =150x500+500+0
  253.  irit*Trans*BackGround:
  254.   Black
  255.  irit*View*Geometry:
  256.   =500x500+0+0
  257.  irit*View*BackGround:
  258.   Black
  259.  irit*MaxColors:
  260.  \#endif
  261. @\section{First Usage}
  262. !FIRSTUSAGE
  263.    Commands to {\em IRIT} are entered using a textual interface, usually
  264.  from the same window the program was executed from.
  265.    Some important commands to begin with are,
  266.    1. include("file.irt"); - will execute the commands in file.irt. Note
  267.       include can be recursive up to 10 levels. To execute the demo
  268.       (demo.irt) simply type 'include("demo.irt");'. Another way to run
  269.       the demo is by typing demo(); which is a predefined procedure defined
  270.       in iritinit.irt.
  271.    2. help(""); - will print all available commands and how to get help on
  272.       them. A file called irit.hlp will be searched as irit.cfg is
  273.       being searched (see above), to provide the help.
  274.    3. exit(); - close everything and exit {\em IRIT}.
  275.    Most operators are overloaded. This means that you can multiply
  276.  two scalars (numbers), or two vectors, or even two matrices, with the same
  277.  multiplication operator ($*$). To get the on-line help on the
  278.  operator '$*$' type 'help("$*$");'
  279.    The best way to learn this program (like any other program...) is by
  280.  trying it. Print the manual and study each of the commands available.
  281.    Study the demo programs ($*$.irt) provided as well.
  282.    The "best" mode to use irit is via the emacs editor. With this distribution
  283.  an emacs mode for irit files (irt postfix) is provided (irit.el). Make your
  284.  .emacs load this file automatically. Loading file.irt will switch emacs into
  285.  Irit mode that supports the following three keystrokes:
  286. # 18 2 1 1
  287.  Meta-E
  288.   Executes the current line
  289.  Meta-R
  290.   Executes the current Region (Between Cursor and Mark)
  291.  Meta-S
  292.   Executes a single line from input buffer
  293.    The first time one of the above keystrokes is hit, emacs will fork an Irit
  294.  process so that Irit's stdin is controlled via the above commands.
  295.    This emacs mode was tested under various unix environments and under OS2
  296.  2.x.
  297. @\section{Data Types}
  298. !DATATYPES
  299.   These are the Data Types recognized by the solid modeler. They are also
  300.  used to define the calling sequences of the different functions below:
  301. # 18 2 1 1
  302.  {\bf ConstantType}
  303.   Scalar real type that cannot be modified.
  304.  {\bf NumericType}
  305.   Scalar real type.
  306.  {\bf VectorType}
  307.   3D real type vector.
  308.  {\bf PointType}
  309.   3D real type point.
  310.  {\bf CtlPtType}
  311.   Control point of a freeform curve or surface.
  312.  {\bf MatrixType}
  313.   4 by 4 matrix (homogeneous transformation matrix).
  314.  {\bf PolygonType}
  315.   Object consists of polygons.
  316.  {\bf PolylineType}
  317.   Object consists of polylines.
  318.  {\bf CurveType}
  319.   Object consists of curves.
  320.  {\bf SurfaceType}
  321.   Object consists of surfaces.
  322.  {\bf GeometricType}
  323.   One of Polygon/lineType, CurveType, SurfaceType.
  324.  {\bf GeometricTreeType}
  325.   A list of GeometricTypes or GeometricTreeTypes.
  326.  {\bf StringType}
  327.   Sequence of chars within double quotes - "A string".
  328.   Current implementation is limited to 80 chars.
  329.  {\bf AnyType}
  330.   Any of the above.
  331.  {\bf ListType}
  332.   List of (any of the above type) objects. List 
  333.   size is dynamically increased, as needed.
  334.   Although points and vectors are not the same, {\em IRIT} does not
  335.  destinguish between them, most of the time. This might change in the future.
  336. @\section{Commands summary}
  337. !COMMANDS
  338.  These are all the commands and operators supported by the {\em IRIT} solid
  339.  modeler:
  340. # 11 6 1 0
  341.  \verb+^+
  342.  $==$
  343.  $!=$
  344.  $<=$
  345.  $>=$
  346.  ACOS
  347.  ADAPISO
  348.  AREA
  349.  ASIN
  350.  ATAN
  351.  ATAN2
  352.  ATTRIB
  353.  AOFFSET
  354.  BOOLONE
  355.  BOOLSUM
  356.  BSP2BZR
  357.  BZR2BSP
  358.  CBEZIER
  359.  CBSPLINE
  360.  CCINTER
  361.  CCRVTR
  362.  CDERIVE
  363.  CDIVIDE
  364.  CEDITPT
  365.  CEVAL
  366.  CEXTREMES
  367.  CHDIR
  368.  CINFLECT
  369.  CIRCLE
  370.  CIRCPOLY
  371.  CMESH
  372.  COERCE
  373.  COLOR
  374.  COMMENT
  375.  CON2
  376.  CONE
  377.  CONVEX
  378.  COORD
  379.  COMPOSE
  380.  CPOLY
  381.  CRAISE
  382.  CREFINE
  383.  CREGION
  384.  CROSSEC
  385.  CRVLNDST
  386.  CRVPTDST
  387.  CSURFACE
  388.  CTANGENT
  389.  CTLPT
  390.  CYLIN
  391.  CZEROS
  392.  EXIT
  393.  EXTRUDE
  394.  FFCOMPAT
  395.  FREE
  396.  FUNCTION
  397.  GBOX
  398.  GPOLYGON
  399.  GPOLYLINE
  400.  HELP
  401.  HOMOMAT
  402.  INCLUDE
  403.  INTERACT
  404.  LIST
  405.  LISTSIZE
  406.  LOAD
  407.  LOGFILE
  408.  MERGEPOLY
  409.  OFFSET
  410.  PAUSE
  411.  PDOMAIN
  412.  POLY
  413.  PRINTF
  414.  PRISA
  415.  PROCEDURE
  416.  ROTX
  417.  ROTY
  418.  ROTZ
  419.  RULEDSRF
  420.  SAVE
  421.  SBEZIER
  422.  SBSPLINE
  423.  SCALE
  424.  SDERIVE
  425.  SDIVIDE
  426.  SEDITPT
  427.  SEVAL
  428.  SFROMCRVS
  429.  SMERGE
  430.  SMORPH
  431.  SNOC
  432.  SNORMAL
  433.  SNRMLSRF
  434.  SPHERE
  435.  SQRT
  436.  SRAISE
  437.  SREFINE
  438.  SREGION
  439.  STANGENT
  440.  SURFREV
  441.  SWEEPSRF
  442.  SYMBCPROD
  443.  SYMBDIFF
  444.  SYMBDPROD
  445.  SYMBPROD
  446.  SYMBSUM
  447.  SYSTEM
  448.  TIME
  449.  THISOBJ
  450.  TORUS
  451.  TRANS
  452.  VARLIST
  453.  VECTOR
  454.  VIEW
  455.  VIEWOBJ
  456.  VOLUME
  457. @\section{Functions and Variables}
  458. !FUNCTIONS
  459. @ This section lists all the functions supported by the {\em IRIT} system
  460. @ according to their classes - mostly, the object type they return.
  461.  Functions that return a {\bf NumericType}:
  462. # 11 5 1 0
  463.  ACOS
  464.  AREA
  465.  ASIN
  466.  ATAN
  467.  ATAN2
  468.  CPOLY
  469.  LISTSIZE
  470.  SQRT
  471.  THISOBJ
  472.  VOLUME
  473.  Functions that return a {\bf GeometricType}:
  474. # 11 6 1 0
  475.  ADAPISO
  476.  AOFFSET
  477.  BOOLONE
  478.  BOOLSUM
  479.  BSP2BZR
  480.  BZR2BSP
  481.  CBEZIER
  482.  CBSPLINE
  483.  CCINTER
  484.  CCRVTR
  485.  CDERIVE
  486.  CDIVIDE
  487.  CEDITPT
  488.  CEVAL
  489.  CEXTREMES
  490.  CINFLECT
  491.  CIRCLE
  492.  CIRCPOLY
  493.  CMESH
  494.  COERCE
  495.  COMPOSE
  496.  CON2
  497.  CONE
  498.  CONVEX
  499.  COORD
  500.  CPOLY
  501.  CRAISE
  502.  CREFINE
  503.  CREGION
  504.  CROSSEC
  505.  CRVLNDST
  506.  CRVPTDST
  507.  CSURFACE
  508.  CTANGENT
  509.  CTLPT
  510.  CYLIN
  511.  CZEROS
  512.  EXTRUDE
  513.  FFCOMPAT
  514.  GBOX
  515.  GPOLYGON
  516.  GPOLYLINE
  517.  MERGEPOLY
  518.  OFFSET
  519.  PDOMAIN
  520.  POLY
  521.  PRISA
  522.  PROCEDURE
  523.  RULEDSRF
  524.  SBEZIER
  525.  SBSPLINE
  526.  SDERIVE
  527.  SDIVIDE
  528.  SEDITPT
  529.  SEVAL
  530.  SFROMCRVS
  531.  SMERGE
  532.  SMORPH
  533.  SNORMAL
  534.  SNRMLSRF
  535.  SPHERE
  536.  SRAISE
  537.  SREFINE
  538.  SREGION
  539.  STANGENT
  540.  SURFREV
  541.  SWEEPSRF
  542.  SYMBCPROD
  543.  SYMBDIFF
  544.  SYMBDPROD
  545.  SYMBPROD
  546.  SYMBSUM
  547.  TORUS
  548.  Functions that create linear transformation matrices:
  549. # 11 6 1 0
  550.  HOMOMAT
  551.  ROTX
  552.  ROTY
  553.  ROTZ
  554.  SCALE
  555.  TRANS
  556.  Miscellaneous functions:
  557. # 11 6 1 0
  558.  ATTRIB
  559.  CHDIR
  560.  COLOR
  561.  COMMENT
  562.  EXIT
  563.  FREE
  564.  FUNCTION
  565.  HELP
  566.  INCLUDE
  567.  INTERACT
  568.  LIST
  569.  LOAD
  570.  LOGFILE
  571.  PAUSE
  572.  PRINTF
  573.  PROCEDURE
  574.  SAVE
  575.  SNOC
  576.  SYSTEM
  577.  TIME
  578.  VARLIST
  579.  VECTOR
  580.  VIEW
  581.  VIEWOBJ
  582.  Variables that are predefined in the system:
  583. # 11 5 1 0
  584.  AXES
  585.  COPLANAR
  586.  DRAWCTLPT
  587.  DUMPLVL
  588.  ECHOSRC
  589.  FLAT4PLY
  590.  INTERCRV
  591.  MACHINE
  592.  POLYSORT
  593.  PRSP\_MAT
  594.  RESOLUTION
  595.  VIEW\_MAT
  596.  Constants that are predefined in the system:
  597. # 11 6 1 0
  598.  APOLLO
  599.  BLACK
  600.  BLUE
  601.  CYAN
  602.  FALSE
  603.  GREEN
  604.  KV\_FLOAT
  605.  KV\_OPEN
  606.  MAGENTA
  607.  MSDOS
  608.  TRUE
  609.  UNIX  
  610.  WHITE
  611.  YELLOW
  612. @\section{Language description}
  613. !LANGUAGE
  614.     The front end of the {\em IRIT} solid modeler is an infix parser that
  615.  mimics some of the C language behavior. The infix operators that are supported
  616.  are plus (+), minus (-), multiply (*), divide (/), and power (\verb+^+), for
  617.  numeric operators, with the same precedence as in C.
  618.     However, unlike the C language, these operators are overloaded,
  619. @\footnote{In fact the C language does support overloaded operators to some
  620. @extent: '1 + 2' and '1.0 + 2.0' implies invocation of two different
  621. @actions.}
  622.  or different action is taken, based upon the different operands.
  623.    This means that one can write '1 + 2', in which the plus sign denotes a
  624.  numeric addition, or one can write 'PolyObj1 + PolyObj2', in which case the
  625.  plus sign denotes the Boolean operation of a union between two geometric
  626.  objects.
  627.    The exact way each operator is overloaded is defined below.
  628.    In this environment, reals, integers, and even Booleans, are all represented
  629.  as real types. Data are automatically promoted as necessary.
  630.    For example, the constants TRUE and FALSE are defined as 1.0 and 0.0
  631.  respectively.
  632.    Each expression is terminated by a semicolon. An expression can be as
  633.  simple as 'a;' which prints the value of variable a, or as complex as:
  634. @\begin{verbatim}
  635.     for ( t = 1.1, 0.1, 1.9,
  636.             cb1 = csurface( sb, COL, t ):
  637.             color( cb1, green ):
  638.             snoc( cb1, cb_all )
  639.         );
  640. @\end{verbatim}
  641.    While an expression is terminated with a semicolon, a colon is used to
  642.  terminate mini-expressions within an expression.
  643.    Once a complete expression is read in (i.e., a semicolon is detected)
  644.  and parsed correctly (i.e. no syntax errors are found), it is executed.
  645.    Before each operator or a function is executed, parameter type matching
  646.  tests are made to make sure the operator can be applied to these
  647.  operand(s), or that the function gets the correct set of arguments.
  648.    The parser is totally case insensitive, so Obj, obj, and OBJ will refer
  649.  to the same object, while MergePoly, MERGEPOLY, and mergePoly will refer
  650.  to the same function.
  651.    Objects (Variables if you prefer) need not be declared. Simply use them
  652.  when you need them. Object names may be any alpha-numeric (and underscore)
  653.  string of at most 30 characters. By assigning to an old object, the old
  654.  object will be automatically deleted and if necessary its type will be
  655.  modified on the fly.
  656.  Example:
  657. @\begin{verbatim}
  658.     V = sin( 45 * pi / 180.0 );
  659.     V = V * vector( 1, 2, 3 );
  660.     V = V * rotx( 90 );
  661.     V = V * V;
  662. @\end{verbatim}
  663.  will assign to V a NumericType equal to the sine of 45 degrees, the VectorType
  664.  ( 1, 2, 3 ) scaled by the sine of 45, rotate that vector around the X axis
  665.  by 90 degrees, and finally a NumericType which is the dot (inner) product of
  666.  V with itself.
  667.    The parser will read from stdin, unless a file is specified on the command
  668.  line or an INCLUDE command is executed. In both cases, when the end of file
  669.  is encountered, the parser will again wait for input from stdin. In order
  670.  to execute a file and quit in the end of the file, put an EXIT command as
  671.  the last command in the file.
  672. @\section{Operator overloading}
  673. @ The basic operators $+$, $-$, $*$, $/$, and \verb+^+ are overloaded.
  674. @ This section describes what action is taken by each of these operators
  675. @ depending on its arguments.
  676. @\subsection{Overloading $+$}
  677.  The $+$ operator is overloaded above the following domains:
  678. @\begin{verbatim}
  679.   NumericType + NumericType -> NumericType
  680.   VectorType  + VectorType  -> VectorType   (Vector addition)
  681.   MatrixType  + MatrixType  -> MatrixType   (Matrix addition)
  682.   PolygonType + PolygonType -> PolygonType  (Boolean UNION operation)
  683.   CurveType   + CurveType   -> CurveType    (Curve curve profiling)
  684.   CurveType   + CtlPtType   -> CurveType    (Curve control point profiling)
  685.   CtlPtType   + CtlPtType   -> CurveType    (Control points profiling)
  686.   ListType    + ListType    -> ListType     (Append lists operator)
  687.   StringType  + StringType  -> StringType   (String concat)
  688.   StringType  + RealType    -> StringType   (String concat, real as int string)
  689. @\end{verbatim}
  690.  Note: Boolean UNION of two disjoint objects (no common volume) will result
  691.  with the two objects combined. It is the USER responsibility to make sure that
  692.  the non intersecting objects are also disjoint - this system only tests for
  693.  no intersection.
  694. @\subsection{Overloading $-$}
  695.  The $-$ operator is overloaded above the following domains:
  696.  As a binary operator:
  697. @\begin{verbatim}
  698.   NumericType - NumericType -> NumericType
  699.   VectorType  - VectorType  -> VectorType   (Vectoric difference)
  700.   MatrixType  - MatrixType  -> MatrixType   (Matrix difference) 
  701.   PolygonType - PolygonType -> PolygonType  (Boolean SUBTRACT operation)
  702. @\end{verbatim}
  703.  As a unary operator:
  704. @\begin{verbatim}
  705.   - NumericType -> NumericType
  706.   - VectorType  -> VectorType    (Scale vector by -1)
  707.   - MatrixType  -> MatrixType    (Scale matrix by -1)
  708.   - PolygonType -> PolygonType   (Boolean NEGATION operation)
  709.   - CurveType   -> CurveType     (Curve parameterization is reversed)
  710.   - SurfaceType -> SurfaceType   (Surface parameterization is reversed)
  711. @\end{verbatim}
  712.  Note: Boolean SUBTRACT of two disjoint objects (no common volume) will result
  713.  with an empty object. For both a curve and a surface parameterization, reverse
  714.  operation (binary minus) causes the object normal to be flipped as a side
  715.  effect.
  716. @\subsection{Overloading $*$}
  717.  The $*$ operator is overloaded above the following domains:
  718. @\begin{verbatim}
  719.   NumericType * NumericType   -> NumericType
  720.   VectorType  * NumericType   -> VectorType    (Vector scaling)
  721.   VectorType  * VectorType    -> NumericType   (Inner product)
  722.   MatrixType  * NumericType   -> MatrixType    (Matrix Scaling)
  723.   MatrixType  * VectorType    -> VectorType    (Vector transformation)
  724.   MatrixType  * MatrixType    -> MatrixType    (Matrix multiplication)
  725.   MatrixType  * GeometricType -> GeometricType (Object transformation)
  726.   MatrixType  * ListType      -> ListType      (Object hierarchy transform.)
  727.   PolygonType * PolygonType   -> PolygonType   (Boolean INTERSECTION operation)
  728. @\end{verbatim}
  729.  Note: Boolean INTERSECTION of two disjoint objects (no common volume) will
  730.  result with an empty object. Object hierarchy transform transforms any
  731.  transformable object (GeometricType) found in the list recursively.
  732. @\subsection{Overloading $/$}
  733.  The $/$ operator is overloaded above the following domains:
  734. @\begin{verbatim}
  735.   NumericType / NumericType -> NumericType
  736.   PolygonType / PolygonType -> PolygonType   (Boolean CUT operation)
  737. @\end{verbatim}
  738.  Note: Boolean CUT of two disjoint objects (no common volume) will result
  739.  with an empty object.
  740. @\subsection{Overloading \^{\ }}
  741.  The \verb+^+ operator is overloaded above the following domains:
  742. @\begin{verbatim}
  743.   NumericType ^ NumericType -> NumericType
  744.   VectorType  ^ VectorType  -> VectorType  (Cross product)
  745.   MatrixType  ^ NumericType -> MatrixType  (Matrix to the (int) power)
  746.   PolygonType ^ PolygonType -> PolygonType (Boolean MERGE operation)
  747.   StringType  ^ StringType  -> StringType  (String concat)
  748.   StringType  ^ RealType    -> StringType  (String concat, real as real string)
  749. @\end{verbatim}
  750.  Note: Boolean MERGE simply merges the two sets of polygons without any
  751.  intersection tests. Matrix powers must be positive integers or -1, in which
  752.  case the matrix inverse (if it exists) is computed.
  753. @\subsection{Assignments}
  754.    Assignments are allowed as side effects, in any place in an expression.
  755.  If "Expr" is an expression, then "var = Expr" is the exact same expression
  756.  with the side effect of setting Var to that value. There is no guarantee
  757.  on the order of evaluation, so using Vars that are set within the same
  758.  expression is a bad practice. Use parentheses to force the order of
  759.  evaluation, i.e., "( var = Expr )".
  760. @\subsection{Comparison operators $==$, $!=$, $<$, $>$, $<=$, $>=$}
  761. &Comparison operators ==, !=, <, >, <=, >=
  762.  The conditional comparison operators can be applied to the following
  763.  domains (o for a comparison operator):
  764. @\begin{verbatim}
  765.   NumericType o NumericType -> NumericType
  766.   StringType  o StringType  -> NumericType
  767.   PointType   o PointType   -> NumericType
  768.   VectorType  o VectorType  -> NumericType
  769.   PlaneType   o PlaneType   -> NumericType
  770. @\end{verbatim}
  771.  The returned NumericType is non-zero if the condition holds, or zero if
  772.  not.
  773.    For PointTypes, VectorTypes, and PlaneTypes, only $==$ and $!=$ comparisons
  774.  are valid. This is either the same or different.
  775.    For NumericTypes and StringTypes (uses strcmp) all comparisons are valid.
  776. @\subsection{Logical operators $\&\&$, $\|\|$, !}
  777. &Logical operators &&, ||, !
  778.  Complex logical expressions can be defined using the logical {\em and} ($\&\&$),
  779.  logical {\em or} ($\|\|$) and logical {\em not} (!). These operators can be applied
  780.  to NumericTypes that are considered Boolean results. That is, true for a
  781.  non-zero value, and false otherwise.
  782.    The returned NumericType is true if both operands are true for the {\em and}
  783.  operator, at least one is true for the {\em or} operator, and the operand is
  784.  false for the {\em not} operator. In all other cases, a false is returned.
  785.    To make sure Logical expressions are readable, the {\em and} and {\em or}
  786.  operators are defined to have the {\em same} priority. Use parentheses to
  787.  disambiguate a logical expression and to make it more readable.
  788. @\subsection{Priority of operators}
  789. &Priority of operators
  790.    The following table lists the priority of the different operators.
  791. # 19 3 0 1
  792.  Lowest
  793.  Operator
  794.  Name of operator
  795.  priority
  796.  comma
  797.  colon
  798.  $\&\&$, $\|\|$
  799.  logical and, logical or
  800.  =,==,!=,<=,>=,<,>
  801.  assignment, equal, not equal, less
  802.  equal, greater equal, less, greater
  803.  +, -
  804.  plus, minus
  805.  *, /
  806.  multiply, divide
  807.  Highest
  808.  \verb+^+
  809.  power
  810.  priority
  811.  -, !
  812.  unary minus, logical not
  813. @\subsection{Grammar}
  814. &Grammar
  815.    The grammar of the {\em IRIT} parser follows similar guidelines as
  816.  the C language for simple expressions. However, complex statements differ.
  817.    See the IF, FOR, FUNCTION, and PROCEDURE below for the usage of these
  818.  clauses.
  819. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  820. @\section{Function Description}
  821. &Function Description
  822. @ The description below defines the parameters and returned values of the
  823. @ predefined functions in the system, using the notation of functions
  824. @ in ANSI C. Listed are all the functions in the system, in alphabetic
  825. @ order, according to their classes.
  826. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  827. @\subsection{NumericType returning functions}
  828. &NumericType returning functions
  829. @\subsubsection{ABS}
  830. @\begin{verbatim}
  831.  NumericType ABS( NumericType Operand )
  832. @\end{verbatim}
  833.    Returns the absolute value of the given {\bf Operand}.
  834. @\subsubsection{ACOS}
  835. !ACOS
  836. @\begin{verbatim}
  837.  NumericType ACOS( NumericType Operand )
  838. @\end{verbatim}
  839.    Returns the arc cosine value (in radians) of the given {\bf Operand}.
  840. @\subsubsection{AREA}
  841. !AREA
  842. @\begin{verbatim}
  843.  NumericType AREA( PolygonType Object )
  844. @\end{verbatim}
  845.    Returns the area of the given {\bf Object} (in object units). Returned is
  846.  the area of the polygonal object, not the area of the primitive it might
  847.  approximate.
  848.    This means that the area of a polygonal approximation of a sphere will be
  849.  returned, not the exact area of the sphere.
  850. @\subsubsection{ASIN}
  851. !ASIN
  852. @\begin{verbatim}
  853.  NumericType ASIN( NumericType Operand )
  854. @\end{verbatim}
  855.    Returns the arc sine value (in radians) of the given {\bf Operand}.
  856. @\subsubsection{ATAN}
  857. !ATAN
  858. @\begin{verbatim}
  859.  NumericType ATAN( NumericType Operand )
  860. @\end{verbatim}
  861.    Returns the arc tangent value (in radians) of the given {\bf Operand}.
  862. @\subsubsection{ATAN2}
  863. !ATAN2
  864. @\begin{verbatim}
  865.  NumericType ATAN2( NumericType Operand1, NumericType Operand2 )
  866. @\end{verbatim}
  867.    Returns the arc tangent value (in radians) of the given ratio:
  868.  {\bf Operand1} / {\bf Operand2}, over the whole circle.
  869. @\subsubsection{COS}
  870. @\begin{verbatim}
  871.  NumericType COS( NumericType Operand )
  872. @\end{verbatim}
  873.    Returns the cosine value of the given {\bf Operand} (in radians).
  874. @\subsubsection{CPOLY}
  875. !CPOLY
  876. @\begin{verbatim}
  877.  NumericType CPOLY( PolygonType Object )
  878. @\end{verbatim}
  879.    Returns the number of polygons in the given polygonal {\bf Object}.
  880. @\subsubsection{EXP}
  881. @\begin{verbatim}
  882.  NumericType EXP( NumericType Operand )
  883. @\end{verbatim}
  884.    Returns the natural exponent value of the given {\bf Operand}.
  885. @\subsubsection{LISTSIZE}
  886. !LISTSIZE
  887. @\begin{verbatim}
  888.  NumericType LISTSIZE( ListType List | PolyType Poly )
  889. @\end{verbatim}
  890.    Returns the length of a list, if {\bf List}, or the number of polygons
  891.  if {\bf Poly}. If, however, only one polygon is in {\bf Poly}, it returns
  892.  the number of vertices in that polygon.
  893.  Example:
  894. @\begin{verbatim}
  895.    len = LISTSIZE( list( 1, 2, 3 ) );
  896.    numPolys = LISTSIZE( axes );
  897. @\end{verbatim}
  898.  will assign the value of 3 to the variable {\bf len}, and set {\bf numPolys}
  899.  to the number of polylines in the axes object.
  900. @\subsubsection{LN}
  901. @\begin{verbatim}
  902.  NumericType LN( NumericType Operand )
  903. @\end{verbatim}
  904.    Returns the natural logarithm value of the given {\bf Operand}.
  905. @\subsubsection{LOG}
  906. @\begin{verbatim}
  907.  NumericType LOG( NumericType Operand )
  908. @\end{verbatim}
  909.    Returns the base 10 logarithm value of the given {\bf Operand}.
  910. @\subsubsection{SIN}
  911. @\begin{verbatim}
  912.  NumericType SIN( NumericType Operand )
  913. @\end{verbatim}
  914.    Returns the sine value of the given {\bf Operand} (in radians).
  915. @\subsubsection{SQRT}
  916. !SQRT
  917. @\begin{verbatim}
  918.  NumericType SQRT( NumericType Operand )
  919. @\end{verbatim}
  920.    Returns the square root value of the given {\bf Operand}.
  921. @\subsubsection{TAN}
  922. @\begin{verbatim}
  923.  NumericType TAN( NumericType Operand )
  924. @\end{verbatim}
  925.    Returns the tangent value of the given {\bf Operand} (in radians).
  926. @\subsubsection{THISOBJ}
  927. !THISOBJ
  928. @\begin{verbatim}
  929.  NumericType THISOBJ( AnyType Object )
  930. @\end{verbatim}
  931.    Returns the object type of the given {\bf Object}. This can be one of
  932.  the constants NUMERIC\_TYPE, STRING\_TYPE, VECTOR\_TYPE, POINT\_TYPE,
  933.  CTLPT\_TYPE, MATRIX\_TYPE, POLY\_TYPE, CURVE\_TYPE, or SURFACE\_TYPE.
  934. @\subsubsection{VOLUME}
  935. !VOLUME
  936. @\begin{verbatim}
  937.  NumericType VOLUME( PolygonType Object )
  938. @\end{verbatim}
  939.    Returns the volume of the given {\bf Object} (in object units). It returns
  940.  the volume of the polygonal object, not the volume of the object it might
  941.  approximate.
  942.    This routine decomposes all non-convex polygons to convex ones as a side
  943.  effect (see CONVEX).
  944. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  945. @\subsection{GeometricType returning functions}
  946. &GeometricType returning functions
  947. @\subsubsection{ADAPISO}
  948. !ADAPISO
  949. @\begin{verbatim}
  950.  CurveType ADAPISO( SurfaceType Srf, NumericType Dir, NumericType Eps,
  951.                     NumericType FullIso, NumericType SinglePath )
  952. @\end{verbatim}
  953.  Constructs a {\em coverage} to {\bf Srf} using isocurve in the {\bf Dir} direction,
  954.  so that for any point p on surface {\bf Srf}, there exists a point on one of
  955.  the isocurves that is close to p within {\bf Eps}. If {\bf FullIso}, the
  956.  extracted isocurves span the entire surface domain, otherwise they may
  957.  span only a subset of the domain. If {\bf SinglePath}, an approximation to
  958.  a single path (Hamiltonian path) that visits all isocurves is constructed.
  959. @\begin{verbatim}
  960.     srf = sbezier( list( list( ctlpt( E3, -0.5, -1.0,  0.0 ),
  961.                                ctlpt( E3,  0.4,  0.0,  0.1 ),
  962.                                ctlpt( E3, -0.5,  1.0,  0.0 ) ),
  963.                          list( ctlpt( E3,  0.0, -0.7,  0.1 ),
  964.                                ctlpt( E3,  0.0,  0.0,  0.0 ),
  965.                                ctlpt( E3,  0.0,  0.7, -0.2 ) ),
  966.                          list( ctlpt( E3,  0.5, -1.0,  0.1 ),
  967.                                ctlpt( E3, -0.4,  0.0,  0.0 ),
  968.                                ctlpt( E3,  0.5,  1.0, -0.2 ) ) ) );
  969.     aiso = ADAPISO( srf, COL, 0.1, FALSE, FALSE );
  970. @\end{verbatim}
  971.  Constructs an adaptive isocurve approximation with tolerance of {\bf 0.1} to
  972.  surface {\bf srf} in direction {\bf COL}. Isocurves are allowed to span a
  973.  subset of the surface domain. No single path is needed.
  974.  The {\bf SinglePath} option is currently not supported.
  975. @\subsubsection{ARC}
  976. @\begin{verbatim}
  977.  CurveType ARC( VectorType StartPos, VectorType Center, VectorType EndPos )
  978. @\end{verbatim}
  979.  Constructs an arc between the two end points {\bf StartPos} and {\bf EndPos},
  980.  centered at {\bf Center}. Arc will always be less than 180 degrees, so the
  981.  shortest circular path from {\bf StartPos} to {\bf EndPos} is selected. The
  982.  case where {\bf StartPos}, {\bf Center}, and {\bf EndPos} are collinear is
  983.  illegal, since it attempts to define a 180 degrees arc. Arc is constructed
  984.  as a single rational quadratic Bezier curve.
  985.  Example:
  986. @\begin{verbatim}
  987.     Arc1 = ARC( vector( 1.0, 0.0, 0.0 ),
  988.                 vector( 1.0, 1.0, 0.0 ),
  989.                 vector( 0.0, 1.0, 0.0 ) );
  990. @\end{verbatim}
  991.  constructs a 90 degrees arc, tangent to both the X and Y axes at coordinate 1.
  992. @\subsubsection{AOFFSET}
  993. !AOFFSET
  994. @\begin{verbatim}
  995.  CurveType AOFFSET( CurveType Crv, NumericType OffsetDistance,
  996.                     NumericType Epsilon, NumericType TrimLoops )
  997.  SurfaceType AOFFSET( SurfaceType Srf NumericType OffsetDistance,
  998.                       NumericType Epsilon, NumericType TrimLoops )
  999. @\end{verbatim}
  1000.  Computes an offset of {\bf OffsetDistance} with globally bounded error
  1001.  (controlled by {\bf Epsilon}). The smaller {\bf Epsilon} is, the better
  1002.  the approximation to the offset. The bounded error is achieved by adaptive
  1003.  refinement of the {\bf Crv}.
  1004.    If {\bf TrimLoops} is TRUE or on, the regions of the object that
  1005.  self-intersect as a result of the offset operation are trimmed away.
  1006.  Example:
  1007. @\begin{verbatim}
  1008.  OffCrv = AOFFSET( Crv, 0.5, 0.03, TRUE );
  1009. @\end{verbatim}
  1010.  computes an adaptive offset to {\bf Crv} with {\bf OffsetDistance} of
  1011.  0.5 and {\bf Epsilon} of 0.03 and trims the self-intersection loops.
  1012.  See also OFFSET.
  1013. @\subsubsection{BOOLONE}
  1014. !BOOLONE
  1015. @\begin{verbatim}
  1016.  SurfaceType BOOLONE( CurveType Crv )
  1017. @\end{verbatim}
  1018.  Given a closed curve, the curve is subdivided into four segments equally
  1019.  spaced in the parametric space that are fed into BOOLSUM. Useful if
  1020.  a surface should "fill" the area enclosed by a closed curve.
  1021.  Example:
  1022. @\begin{verbatim}
  1023.  Srf = BOOLONE( circle( vector( 0.0, 0.0, 0.0 ), 1.0 ) );
  1024. @\end{verbatim}
  1025.  Creates a disk surface containing the area enclosed by the unit circle.
  1026. @\subsubsection{BOOLSUM}
  1027. !BOOLSUM
  1028. @\begin{verbatim}
  1029.  SurfaceType BOOLSUM( CurveType Crv1, CurveType Crv2,
  1030.                       CurveType Crv3, CurveType Crv4 )
  1031. @\end{verbatim}
  1032.  Construct a surface using the provided four curves as its four boundary
  1033.  curves. Curves do not have to have the same order or type, and will be
  1034.  promoted to their least common denominator. The end points of the four
  1035.  curves should match as follows:
  1036. # 30 2 0 1
  1037.  {\bf Crv1} start point,
  1038.   to {\bf Crv3} start point.
  1039.  {\bf Crv1} end point,
  1040.   to {\bf Crv4} start point.
  1041.  {\bf Crv2} start point,
  1042.   to {\bf Crv3} end point.
  1043.  {\bf Crv2} end point,
  1044.   to {\bf Crv4} end point.
  1045.  where {\bf Crv1} and {\bf Crv2} are the two boundaries in one parametric
  1046.  direction, and {\bf Crv3} and {\bf Crv4} are the two boundaries in the other
  1047.  parametric direction.
  1048.  Example:
  1049. @\begin{verbatim}
  1050.     Cbzr1 = cbezier( list( ctlpt( E3, 0.1, 0.1, 0.1 ),
  1051.                            ctlpt( E3, 0.0, 0.5, 1.0 ),
  1052.                            ctlpt( E3, 0.4, 1.0, 0.4 ) ) );
  1053.     Cbzr2 = cbezier( list( ctlpt( E3, 1.0, 0.2, 0.2 ),
  1054.                            ctlpt( E3, 1.0, 0.5, -1.0 ),
  1055.                            ctlpt( E3, 1.0, 1.0, 0.3 ) ) );
  1056.     Cbsp3 = cbspline( 4,
  1057.                       list( ctlpt( E3, 0.1,  0.1, 0.1 ),
  1058.                             ctlpt( E3, 0.25, 0.0, -1.0 ),
  1059.                             ctlpt( E3, 0.5,  0.0, 2.0 ),
  1060.                             ctlpt( E3, 0.75, 0.0, -1.0 ),
  1061.                             ctlpt( E3, 1.0,  0.2, 0.2 ) ),
  1062.                       list( KV_OPEN ) );
  1063.     Cbsp4 = cbspline( 4,
  1064.                       list( ctlpt( E3, 0.4,  1.0, 0.4 ),
  1065.                             ctlpt( E3, 0.25, 1.0, 1.0 ),
  1066.                             ctlpt( E3, 0.5,  1.0, -2.0 ),
  1067.                             ctlpt( E3, 0.75, 1.0, 1.0 ),
  1068.                             ctlpt( E3, 1.0,  1.0, 0.3 ) ),
  1069.                       list( KV_OPEN ) );
  1070.     Srf = BOOLSUM( Cbzr1, Cbzr2, Cbsp3, Cbsp4 );
  1071. @\end{verbatim}
  1072. @\subsubsection{BOX}
  1073. @\begin{verbatim}
  1074.  PolygonType BOX( VectorType Point,
  1075.                   NumericType Dx, NumericType Dy, NumericType Dz )
  1076. @\end{verbatim}
  1077.    Creates a BOX polygonal object, whose boundary is coplanar with the
  1078.  $XY$, $XZ$, and $YZ$ planes. The BOX is defined by {\bf Point} as
  1079.  base position, and {\bf Dx, Dy, Dz} as BOX dimensions. Negative dimensions
  1080.  are allowed.
  1081.  Example:
  1082. @\begin{verbatim}
  1083.     B = BOX( vector( 0, 0, 0 ), 1, 1, 1);
  1084. @\end{verbatim}
  1085.  creates a unit cube from 0 to 1 in all axes.
  1086. @\subsubsection{BZR2BSP}
  1087. !BZR2BSP
  1088. @\begin{verbatim}
  1089.  CurveType BZR2BSP( CurveType Crv )
  1090.  SurfaceType BZR2BSP( SurfaceType Srf )
  1091. @\end{verbatim}
  1092.    Creates a Bspline curve or a Bspline surface from the given Bezier curve or
  1093.  Bezier surface. The Bspline curve or surface is assigned open end knot
  1094.  vector(s) with no interior knots, in the parametric domain of zero to one.
  1095.  Example:
  1096. @\begin{verbatim}
  1097.     BspSrf = BZR2BSP( BzrSrf );
  1098. @\end{verbatim}
  1099. @\subsubsection{BSP2BZR}
  1100. !BSP2BZR
  1101. @\begin{verbatim}
  1102.  CurveType | ListType BSP2BZR( CurveType Crv )
  1103.  SurfaceType | ListType BSP2BZR( SurfaceType Srf )
  1104. @\end{verbatim}
  1105.    Creates Bezier curve(s) or surface(s) from a given Bspline curve or a
  1106.  Bspline surface. The Bspline input is subdivided at all internal knots to
  1107.  create Bezier curves or surfaces. Therefore, if the input Bspline does have
  1108.  internal knots, a list of Bezier curves or surfaces is returned. Otherwise,
  1109.  a single Bezier curve or surface is returned.
  1110.  Example:
  1111. @\begin{verbatim}
  1112.     BzrCirc = BSP2BZR( circle( vector( 0.0, 0.0, 0.0 ), 1.0 ) );
  1113. @\end{verbatim}
  1114.  would subdivide the unit circle into four 90 degrees Bezier arcs returned
  1115.  in a list.
  1116. @\subsubsection{CBEZIER}
  1117. !CBEZIER
  1118. @\begin{verbatim}
  1119.  CurveType CBEZIER( ListType CtlPtList )
  1120. @\end{verbatim}
  1121.    Creates a Bezier curve out of the provided control point list. {\bf CtlPtList}
  1122.  is a list of control points, all of which must be of the same type (E1-E5, P1-P5),
  1123.  defining the curve's control polygon.
  1124. @The created curve is the polynomial (or rational),
  1125. @\begin{equation}
  1126. @     C(t) = \sum_{i=0}^k P_i B_i(t),
  1127. @\end{equation}
  1128. @where $P_i$ are the control points {\bf CtlPtList}, and k is the degree of
  1129. @the curve, which is one less than the number of points.
  1130.  Example:
  1131. @\begin{verbatim}
  1132.     s45 = sin(pi / 4);
  1133.     Arc90 = CBEZIER( list( ctlpt( P2, 1.0, 0.0, 1.0 ),
  1134.                            ctlpt( P2, s45, s45, s45 ),
  1135.                            ctlpt( P2, 1.0, 1.0, 0.0 ) ) );
  1136. @\end{verbatim}
  1137.  constructs an arc of 90 degrees as a rational quadratic Bezier curve.
  1138. @\subsubsection{CBSPLINE}
  1139. !CBSPLINE
  1140. @\begin{verbatim}
  1141.  CurveType CBSPLINE( NumericType Order, ListType CtlPtList,
  1142.                                                         ListType KnotVector )
  1143. @\end{verbatim}
  1144.    Creates a Bspline curve out of the provided control point list, the
  1145.  knot vector, and the specified order. {\bf CtlPtList} is a list of control
  1146.  points, all of which must be of the same type (E1-E5, P1-P5), defining the
  1147.  curve's control polygon. The length of the {\bf KnotVector} must be equal
  1148.  to the number of control points in {\bf CtlPtList} plus the {\bf Order}.
  1149.    The knot vector list may be specified as either {\bf list( KV\_OPEN )} or
  1150.  {\bf list( KV\_FLOAT )} in which a uniform open or uniform floating knot
  1151.  vector with the appropriate length is automatically constructed. 
  1152. @The created curve is the piecewise polynomial (or rational),
  1153. @\begin{equation}
  1154. @     C(t) = \sum_{i=0}^k P_i B_{i,\tau}(t),
  1155. @\end{equation}
  1156. @where $P_i$ are the control points {\bf CtlPtList} and k is the degree of
  1157. @the curve, which is one less than the {\bf Order} or number of points.
  1158. @$\tau$ is the knot vector of the curve.
  1159.  Example:
  1160. @\begin{verbatim}
  1161.     s45 = sin(pi / 4);
  1162.     HalfCirc = CBSPLINE( 3,
  1163.                       list( ctlpt( P3, 1.0,  0.0, 0.0,  1.0 ),
  1164.                             ctlpt( P3, s45, -s45, 0.0,  s45 ),
  1165.                             ctlpt( P3, 1.0, -1.0, 0.0,  0.0 ),
  1166.                             ctlpt( P3, s45, -s45, 0.0, -s45 ),
  1167.                             ctlpt( P3, 1.0,  0.0, 0.0, -1.0 ) ),
  1168.                       list( 0, 0, 0, 1, 1, 2, 2, 2 ) );
  1169. @\end{verbatim}
  1170.  constructs an arc of 180 degrees in the XZ plane as a rational quadratic
  1171.  Bspline curve.
  1172. @\subsubsection{CCINTER}
  1173. !CCINTER
  1174. @\begin{verbatim}
  1175.  ListType CCINTER( CurveType Crv1, CurveType Crv2, NumericType Epsilon,
  1176.                                                        NumericType SelfInter )
  1177.  SurfaceType CCINTER( CurveType Crv1, CurveType Crv2, NumericType Epsilon,
  1178.                                                        NumericType SelfInter )
  1179. @\end{verbatim}
  1180.    Computes the intersection point(s) of {\bf Crv1} and {\bf Crv2} in the
  1181.  $XY$ plane. Since this computation involves numeric operations, {\bf Epsilon}
  1182.  controls the accuracy of the parametric values of the result.
  1183.    It returns a list of PointTypes, each containing the parameter of {\bf Crv1}
  1184.  in the X coordinate, and the parameter of {\bf Crv2} in the Y coordinate.
  1185.    If, however, {\bf Epsilon} is negative, a scalar field surface representing
  1186.  the square of the distance function is returned instead.
  1187.    If {\bf SelfInter} is TRUE, {\bf Crv1} and {\bf Crv2} can be the same
  1188.  curve, and self-intersection points are searched instead.
  1189.  Example:
  1190. @\begin{verbatim}
  1191.  crv1 = cbspline( 3,
  1192.                   list( ctlpt( E2, 0, 0 ),
  1193.                         ctlpt( E2, 0.0.5 ),
  1194.                         ctlpt( E2, 0.5, 0.7 ),
  1195.                         ctlpt( E2, 1, 1 ) ),
  1196.                   list( KV_OPEN ) );
  1197.  crv2 = cbspline( 3,
  1198.                   list( ctlpt( E2, 1, 0 ),
  1199.                         ctlpt( E2, 0.7, 0.25 ),
  1200.                         ctlpt( E2, 0.3, 0.5 ),
  1201.                         ctlpt( E2, 0, 1 ) ),
  1202.                   list( KV_OPEN ) );
  1203.  inter_pts = CCINTER( crv1, crv2, 0.0001, FALSE );
  1204. @\end{verbatim}
  1205.  Computes the parameter values of the intersection point of {\bf crv1} and
  1206.  {\bf crv2} to a tolerance of 0.0001.
  1207. @\subsubsection{CCRVTR}
  1208. !CCRVTR
  1209. @\begin{verbatim}
  1210.  NumericType CCRVTR( CurveType Crv, NumericType Epsilon )
  1211.  CurveType CCRVTR( CurveType Crv, NumericType Epsilon )
  1212. @\end{verbatim}
  1213.    Computes the extreme curvature points on {\bf Crv} in the $XY$ plane.
  1214.  This set includes not only points of maximum (convexity) and mimumum
  1215.  (concavity) curvature, but also points of zero curvature such as
  1216.  inflection points.
  1217.    Since this operation is partially numeric, {\bf Epsilon} is used to set
  1218.  the needed accuracy. It returns the parameter value(s) of the location(s)
  1219.  with extreme curvature along the {\bf Crv}.
  1220.    If, however, {\bf Epsilon} is negative, the curvature scalar field
  1221.  curve is returned as a two dimensional rational vector field curve, for
  1222.  which the first dimension is equal to the parameter, and the second is the
  1223.  curvature value at that parameter.
  1224. @   This function computes the curvature scalar field for planar curves as,
  1225. @\begin{equation}
  1226. @      \kappa(t) = \frac{x'(t) y''(t) - x''(t) y'(t)}
  1227. @             {\left( (x'(t))^2 + (y'(t))^2\ \right)^{\frac{3}{2}}},
  1228. @\end{equation}
  1229. @ and computes kN for three dimensional curves as the following vector field,
  1230. @\begin{equation}
  1231. @      \kappa(t) N(t) = \kappa(t) B(t) \times T(t) =
  1232. @    \frac{C' \times C''}{\| C' \| ^ 3} \times \frac{C'}{\| C' \|} =
  1233. @    \frac{(C' \times C'') \times C'}{\| C' \| ^ 4}.
  1234. @\end{equation}
  1235. !   This function computes the curvature scalar field for planar curves as,
  1236. !          x' y'' - x'' y' 
  1237. !   k(t) = ----------------
  1238. !               2     2  3/2
  1239. !           ( x'  + y'  )
  1240. ! and computes kN for three dimensional curves as the following vector field,
  1241. !                                  C' x C''     C'    (C' x C'') x C'
  1242. !   k(t) N(t) = K(t) B(t) x T(t) = -------- x ----- = ---------------
  1243. !                                        3    | C' |            4
  1244. !                                   | C'|                 | C' |
  1245.  The extremum values are extracted from the computed curvature field.
  1246.  This curvature field is a high order curve, even if the input geometry is
  1247.  of low order. This is especially true for rational curves, for which the
  1248.  quotient rule for differentiation is used and almost doubles the degree
  1249.  in every differentiation.
  1250.  See also CZEROS, CEXTREMES, and CCRVTR.
  1251.  Example:
  1252. @\begin{verbatim}
  1253.  crv = cbezier( list( ctlpt( E2, -1.0,  1.0 ),
  1254.                       ctlpt( E2, -0.5, -2.0 ),
  1255.                       ctlpt( E2,  0.0,  2.0 ),
  1256.                       ctlpt( E2,  1.0, -1.0 ) ) );
  1257.  crvtr = ccrvtr( crv, 0.001 );
  1258.  pt_crvtr = nil();
  1259.  pt = nil();
  1260.  for ( i = 1, 1, listsize( crvtr ),
  1261.      pt = ceval( crv, nth( crvtr, i ) ) ):
  1262.      snoc( pt, pt_crvtr )
  1263.  interact( list( crv, pt_crvtr ) );
  1264. @\end{verbatim}
  1265.  finds the extreme curvature points in {\bf Crv} and displays them all
  1266.  with the curve.
  1267. @\subsubsection{CDERIVE}
  1268. !CDERIVE
  1269. @\begin{verbatim}
  1270.  CurveType CDERIVE( CurveType Curve )
  1271. @\end{verbatim}
  1272.    Returns a vector field curve representing the differentiated curve,
  1273.  also known as the Hodograph curve.
  1274.  Example:
  1275. @\begin{verbatim}
  1276.  Hodograph = CDERIVE( Crv );
  1277. @\end{verbatim}
  1278. @\subsubsection{CDIVIDE}
  1279. !CDIVIDE
  1280. @\begin{verbatim}
  1281.  ListType CDIVIDE( CurveType Curve, NumericType Param )
  1282. @\end{verbatim}
  1283.    Subdivides a curve into two sub-curves at the specified parameter value.
  1284.  {\bf Curve} can be either a Bspline curve in which {\bf Param} must be
  1285.  within the Curve's parametric domain, or a Bezier curve in which {\bf Param}
  1286.  must be in the range of zero to one.
  1287.    It returns a list of the two sub-curves. The individual curves may be
  1288.  extracted from the list using the NTH command.
  1289.  Example:
  1290. @\begin{verbatim}
  1291.  CrvLst = CDIVIDE( Crv, 0.5 );
  1292.  Crv1 = nth( CrvLst, 1 );
  1293.  Crv2 = nth( CrvLst, 2 );
  1294. @\end{verbatim}
  1295.  subdivides the curve {\bf Crv} at the parameter value of 0.5.
  1296. @\subsubsection{CEDITPT}
  1297. !CEDITPT
  1298. @\begin{verbatim}
  1299.  CurveType CEDITPT( CurveType Curve, CtlPtType CtlPt, NumericType Index )
  1300. @\end{verbatim}
  1301.    Provides a simple mechanism to manually modify a single control point number
  1302.  {\bf Index} (base count is 0) in {\bf Curve}, by substituting {\bf CtlPt}
  1303.  instead. {\bf CtlPt} must have the same point type as the control points of
  1304.  the  {\bf Curve}. Original curve {\bf Curve} is not modified.
  1305.  Example:
  1306. @\begin{verbatim}
  1307.     CPt = ctlpt( E3, 1, 2, 3 );
  1308.     NewCrv = CEDITPT( Curve, CPt, 1 );
  1309. @\end{verbatim}
  1310.  constructs a {\bf NewCrv} with the second control point of {\bf Curve} being
  1311.  {\bf CPt}.
  1312. @\subsubsection{CEVAL}
  1313. !CEVAL
  1314. @\begin{verbatim}
  1315.  CtlPtType CEVAL( CurveType Curve, NumericType Param )
  1316. @\end{verbatim}
  1317.    Evaluates the provided {\bf Curve} at the given {\bf Param} value.
  1318.  {\bf Param} should be in the curve's parametric domain if {\bf Curve} is
  1319.  a Bspline curve, or between zero and one if {\bf Curve} is a Bezier curve.
  1320.  The returned control point has the same point type as the control points
  1321.  of the {\bf Curve}.
  1322.  Example:
  1323. @\begin{verbatim}
  1324.     CPt = CEVAL( Crv, 0.25 );
  1325. @\end{verbatim}
  1326.  evaluates {\bf Crv} at the parameter value of 0.25.
  1327. @\subsubsection{CEXTREMES}
  1328. !CEXTREMES
  1329. @\begin{verbatim}
  1330.  ListType CEXTREMES( CurveType Crv, NumericType Epsilon, NumericType Axis )
  1331. @\end{verbatim}
  1332.    Computes the extreme set of the given {\bf Crv} in the given axis (1 for X,
  1333.  2 for Y, 3 for Z). Since this computation is numeric, an {\bf Epsilon} is
  1334.  also required to specify the desired tolerance. It returns a list of
  1335.  all the parameter values (NumericType) in which the curve takes an extreme
  1336.  value.
  1337.  Example:
  1338. @\begin{verbatim}
  1339.     extremes = cextremes( crv, 0.0001, 1 );
  1340. @\end{verbatim}
  1341.  Computes the extreme set of curve {\bf crv}, in the {\bf X} axis, with
  1342.  error tolerance of {\bf 0.0001}. See also CZERO.
  1343. @\subsubsection{CINFLECT}
  1344. !CINFLECT
  1345. @\begin{verbatim}
  1346.  ListType CINFLECT( CurveType Crv, NumericType Epsilon )
  1347.  CurveType CINFLECT( CurveType Crv, NumericType Epsilon )
  1348. @\end{verbatim}
  1349.    Computes the inflection points of {\bf Crv} in the $XY$ plane.
  1350.  Since this computation is numeric, an {\bf Epsilon} is also required
  1351.  to specify the desired tolerance. It returns a list of all the
  1352.  parameter values (NumericType) in which the curve has an inflection point.
  1353.    If, however, {\bf Epsilon} is negative, a scalar field curve representing
  1354.  the sign of the curvature of the curve is returned instead.
  1355. @ The sign of curvature scalar field is equal to,
  1356. @\begin{equation}
  1357. @      \sigma(t) = x'(t) y''(t) - x''(t) y'(t).
  1358. @\end{equation}
  1359. ! The sign of curvature scalar field is equal to
  1360. !       s(t) = x' y'' - x'' y' 
  1361.  Example:
  1362. @\begin{verbatim}
  1363.     inflect = CINFLECT( crv, 0.001 );
  1364.     pt_inflect = nil();
  1365.     pt = nil();
  1366.     for ( i = 1, 1, listsize( inflect ),
  1367.             pt = ceval( crv, nth( inflect, i ) ):
  1368.             snoc( pt, pt_inflect )
  1369.         );
  1370.     interact( list( axes, crv, pt_inflect ), 0);
  1371. @\end{verbatim}
  1372.  Computes the set of inflection points of curve {\bf crv} with error
  1373.  tolerance of {\bf 0.001}. This set is then scanned in a loop and
  1374.  evaluated to the curve's locations which are then displayed with the {\bf crv}.
  1375.  See also CZEROS, CEXTREMES, and CCRVTR.
  1376. @\subsubsection{CIRCLE}
  1377. !CIRCLE
  1378. @\begin{verbatim}
  1379.  CurveType CIRCLE( VectorType Center, NumericType Radius )
  1380. @\end{verbatim}
  1381.    Constructs a circle at the specified {\bf Center} with the specified
  1382.  {\bf Radius}. The returned circle is a Bspline curve of four piecewise Bezier
  1383.  90 degree arcs. The construced circle is always parallel to the $XY$ plane.
  1384.  Use the linear transformation routines to place the circle in the appropriate
  1385.  orientation and location.
  1386. @\subsubsection{CIRCPOLY}
  1387. !CIRCPOLY
  1388. @\begin{verbatim}
  1389.  PolygonType CIRCPOLY( VectorType Normal, VectorType Trans, NumericType Radius )
  1390. @\end{verbatim}
  1391.    Defines a circular polygon in a plane perpendicular to {\bf Normal} that
  1392.  contains the {\bf Trans} point. Constructed polygon is centered at
  1393.  {\bf Trans}. RESOLUTION vertices will be defined with {\bf Radius} from
  1394.  distance from {\bf Trans}.
  1395.    Alternative ways to construct a polygon are manual construction of the
  1396.  vertices using POLY, or the construction of a flat ruled surface using
  1397.  RULEDSRF.
  1398. @\subsubsection{CMESH}
  1399. !CMESH
  1400. @\begin{verbatim}
  1401.  CurveType CMESH( SurfaceType Srf, ConstantType Direction, NumericType Index )
  1402. @\end{verbatim}
  1403.    Returns a single ROW or COLumn as specified by the {\bf Direction} and
  1404.  {\bf Index} (base count is 0) of the control mesh of surface {\bf Srf}.
  1405.    The returned curve will have the same knot vector as {\bf Srf} in the
  1406.  appropriate direction. See also CSURFACE.
  1407.    This curve is {\em not} necessarily in the surface {\bf Srf}.
  1408. @It is equal to,
  1409. @\begin{equation}
  1410. @     C(t) = \sum_{i=0}^m P_{ij} B_i(t),
  1411. @\end{equation}
  1412. @and similar for the other parametric direction.
  1413.  Example:
  1414. @\begin{verbatim}
  1415.     Crv = CMESH( Srf, COL, 0 );
  1416. @\end{verbatim}
  1417.  extracts the first column of surface {\bf Srf} as a curve. See also
  1418. @\subsubsection{COERCE}
  1419. !COERCE
  1420. @\begin{verbatim}
  1421.  AnyType COERCE( AnyType Object, ConstantType NewType )
  1422. @\end{verbatim}
  1423.    Provides a coercion mechanism between different objects or object types.
  1424.  PointType, VectorType, PlaneType, CtlPtType can be all coerced to each
  1425.  other by using the {\bf NewType} of POINT\_TYPE, VECTOR\_TYPE, PLANE\_TYPE,
  1426.  or one of E1-E5, P1-P5 (CtlPtType). Similarly, CurveType and SurfaceType
  1427.  can be coerced to hold different CtlPtType of control points.
  1428.  Example:
  1429. @\begin{verbatim}
  1430.     CrvE2 = COERCE( Crv, E2 );
  1431. @\end{verbatim}
  1432.  coerce {\bf Crv} to a new curve that will have an E2 CtlPtType control
  1433.  points. Coerction of a projective curve (P1-P5) to a Euclidean curve
  1434.  (E1-E5) does not preseve the shape of the curve.
  1435. @\subsubsection{COMPOSE}
  1436. !COMPOSE
  1437. @\begin{verbatim}
  1438.  CurveType COMPOSE( CurveType Crv1, CurveType Crv2 )
  1439.  CurveType COMPOSE( SurfaceType Srf, CurveType Crv )
  1440. @\end{verbatim}
  1441.    Symbolically compute the composition curve {\bf Crv1(Crv2(t))} or
  1442.  {\bf Srf(Crv(t))}. In {\bf Crv1(Crv2(t)}, {\bf Crv1} can be any curve
  1443.  while {\bf Crv2} must be a one-dimensional curve that is either E1 or
  1444.  P1. In {\bf Srf(Crv(t))}, {\bf Srf} can be any surface, while {\bf Crv}
  1445.  must be a two-dimensional curve, that is either E2 or P2. Both {\bf Crv2}
  1446.  in the curve's composition, and {\bf Crv} is the surface's composition
  1447.  must be contained in the curve or surface parametric domain.
  1448.  Example:
  1449. @\begin{verbatim}
  1450.    srf = sbezier( list( list( ctlpt( E3, 0.0, 0.0, 0.0 ),
  1451.                               ctlpt( E3, 0.0, 0.5, 1.0 ),
  1452.                               ctlpt( E3, 0.0, 1.0, 0.0 ) ),
  1453.                         list( ctlpt( E3, 0.5, 0.0, 1.0 ),
  1454.                               ctlpt( E3, 0.5, 0.5, 0.0 ),
  1455.                               ctlpt( E3, 0.5, 1.0, 1.0 ) ),
  1456.                         list( ctlpt( E3, 1.0, 0.0, 1.0 ),
  1457.                               ctlpt( E3, 1.0, 0.5, 0.0 ),
  1458.                               ctlpt( E3, 1.0, 1.0, 1.0 ) ) ) );
  1459.    crv = coerce( circle( vector( 0.0, 0.0, 1.0 ), 0.4 ), p2 ) *
  1460.          trans( vector( 0.5, 0.5, 0.0 ) );
  1461.    comp_crv = COMPOSE( srf, crv );
  1462. @\end{verbatim}
  1463.  compose a circle {\bf Crv} to be on the surface {\bf Srf}.
  1464. @\subsubsection{CON2}
  1465. !CON2
  1466. @\begin{verbatim}
  1467.  PolygonType CON2( VectorType Center, VectorType Direction,
  1468.                    NumericType Radius1, NumericType Radius2 )
  1469. @\end{verbatim}
  1470.    Creates a truncated CONE geometric object, defined by {\bf Center} as the
  1471.  center of the main base of the CONE, {\bf Direction} as both the CONE's axis
  1472.  and the length of CONE, and the two radii {\bf Radius1/2} of the two bases of
  1473.  the CONE.
  1474.    Unlike the regular cone (CONE) constructor which has inherited
  1475.  discontinuities in its generated normals at the apex, CON2 can be used to
  1476.  form a (truncated) cone with continuous normals. 
  1477.    See RESOLUTION for the accuracy of the CON2 approximation as a polygonal
  1478.  model.
  1479.  Example:
  1480. @\begin{verbatim}
  1481.     Cone2 = CON2( vector( 0, 0, -1 ), vector( 0, 0, 4 ), 2, 1 );
  1482. @\end{verbatim}
  1483.  constructs a truncated cone with bases parallel to the $XY$ plane at
  1484.  $Z = -1$ and $Z = 3$, and with radii of 2 and 1 respectively.
  1485. @\subsubsection{CONE}
  1486. !CONE
  1487. @\begin{verbatim}
  1488.  PolygonType CONE( VectorType Center, VectorType Direction,
  1489.                    NumericType Radius )
  1490. @\end{verbatim}
  1491.    Creates a CONE geometric object, defined by {\bf Center} as the center of
  1492.  the base of the CONE, {\bf Direction} as the CONE's axis and height, and
  1493.  {\bf Radius} as the radius of the base of the CONE.
  1494.    See RESOLUTION for accuracy of the CONE approximation as a polygonal model. 
  1495.  Example:
  1496. @\begin{verbatim}
  1497.     Cone1 = CONE( vector( 0, 0, 0 ), vector( 1, 1, 1 ), 1 );
  1498. @\end{verbatim}
  1499.  constructs a cone based in an $XY$ parallel plane, centered at the origin
  1500.  with radius 1 and with tilted apex at ( 1, 1, 1 ).
  1501.    See also CON2.
  1502. @\subsubsection{CONVEX}
  1503. !CONVEX
  1504. @\begin{verbatim}
  1505.  PolygonType CONVEX( PolygonType Object )
  1506. @\end{verbatim}
  1507.    Converts non-convex polygons in {\bf Object}, into convex ones. New vertices
  1508.  are introduced into the polygonal data during this process. The Boolean
  1509.  operations require the input to have convex polygons only (although it may
  1510.  return non convex polygons...) and it automatically converts non-convex input
  1511.  polygons to convex ones, using this same routine.
  1512.    However, some external tools (like irit2ray, poly3d-r and poly3d-h) require
  1513.  convex polygons. This function must be used on the objects to guarantee that
  1514.  only convex polygons are saved into data files for these external tools.
  1515. @\begin{verbatim}
  1516.     CnvxObj = CONVEX( Obj );
  1517.     save( "data", CnvxObj );
  1518. @\end{verbatim}
  1519.  converts non-convex polygons into convex ones, so that the data file can be
  1520.  used by external tools requiring convex polygons.
  1521. @\subsubsection{COORD}
  1522. !COORD
  1523. @\begin{verbatim}
  1524.  AnyType COORD( AnyType Object, NumericType Index )
  1525. @\end{verbatim}
  1526.    Extracts an element from a given {\bf Object}, at index {\bf Index}. From
  1527.  a PointType, VectorType, PlaneType, CtlPtType and MatrixType, a NumericType
  1528.  is returned with {\bf Index} 0 for the X axis, 1 for the Y axis etc.
  1529.  {\bf Index} 0 denotes the weight of CtlPtType. For a PolygonType that
  1530.  contains more than one polygon, the {\bf Index}th polygon is returned. For
  1531.  a PolygonType that contains a single Polygon, the {\bf Index}th vertex is
  1532.  returned. For a CurveType or a SurfaceType, the {\bf Index}th CtlPtType is
  1533.  returned. For a ListType, COORD behaves like NTH and returns the {\bf Index}th
  1534.  object in the list.
  1535.  Example:
  1536. @\begin{verbatim}
  1537.     a = vector( 1, 2, 3 );
  1538.     vector( COORD( a, 0 ), COORD( a, 1 ), COORD( a, 2 ) );
  1539.     a = ctlpt( P2, 6, 7, 8, 9 );
  1540.     ctlpt( P3, coord( a, 0 ), coord( a, 1 ), coord( a, 2 ), coord( a, 3 ) );
  1541.     a = plane( 10, 11, 12, 13 );
  1542.     plane( COORD( a, 0 ), COORD( a, 1 ), COORD( a, 2 ), COORD( a, 3 ) );
  1543. @\end{verbatim}
  1544.  constructs a vector/ctlpt/plane and reconstructs it by extracting the
  1545.  constructed scalar components of the objects using COORD.
  1546.    See also COERCE.
  1547. @\subsubsection{CRAISE}
  1548. !CRAISE
  1549. @\begin{verbatim}
  1550.  CurveType CRAISE( CurveType Curve, NumericType NewOrder )
  1551. @\end{verbatim}
  1552.    Raise {\bf Curve} to the {\bf NewOrder} Order specified.
  1553.  Example:
  1554. @\begin{verbatim}
  1555.     Crv = ctlpt( E3, 0.0, 0.0, 0.0 ) +
  1556.           ctlpt( E3, 0.0, 0.0, 1.0 ) +
  1557.           ctlpt( E3, 1.0, 0.0, 1.0 );
  1558.     Crv2 = CRAISE( Crv, 4 );
  1559. @\end{verbatim}
  1560.  raises the 90 degrees corner linear Bspline curve {\bf Crv} to be a cubic.
  1561. @\subsubsection{CREFINE}
  1562. !CREFINE
  1563. @\begin{verbatim}
  1564.  CurveType CREFINE( CurveType Curve, NumericType Replace, ListType KnotList )
  1565. @\end{verbatim}
  1566.    Provides the ability to {\bf Replace} a knot vector of {\bf Curve}, or refine 
  1567.  it. {\bf KnotList} is a list of knots to refine {\bf Curve} at. All knots
  1568.  should be contained in the parametric domain of the {\bf Curve}. If the knot
  1569.  vector is replaced, the length of {\bf KnotList} should be identical to the
  1570.  length of the original knot vector of the {\bf Curve}. If {\bf Curve} is a
  1571.  Bezier curve, it is automatically promoted to be a Bspline curve.
  1572.  Example:
  1573. @\begin{verbatim}
  1574.     Crv2 = CREFINE( Crv, FALSE, list( 0.25, 0.5, 0.75 ) );
  1575. @\end{verbatim}
  1576.  refines {\bf Crv} and adds three new knots at 0.25, 0.5, and 0.75.
  1577. @\subsubsection{CREGION}
  1578. !CREGION
  1579. @\begin{verbatim}
  1580.  CurveType CREGION( CurveType Curve, NumericType MinParam,
  1581.                                                        NumericType MaxParam )
  1582. @\end{verbatim}
  1583.    Extracts a region from {\bf Curve} between {\bf MinParam} and {\bf MaxParam}.
  1584.  Both {\bf MinParam} and {\bf MaxParam} should be contained in the
  1585.  parametric domain of the {\bf Curve}.
  1586.  Example:
  1587. @\begin{verbatim}
  1588.     SubCrv = CREGION( Crv, 0.3, 0.6 );
  1589. @\end{verbatim}
  1590.  extracts the region from {\bf Crv} from the parameter value 0.3 to the
  1591.  parameter value 0.6.
  1592. @\subsubsection{CROSSEC}
  1593. !CROSSEC
  1594. @\begin{verbatim}
  1595.  PolygonType CROSSEC( PolygonType Object )
  1596. @\end{verbatim}
  1597. ;   Invoke interactive mode to edit/create a polygon in the plane Z = 0. The
  1598. ; polygon must be in the domain [0..1] in X,Y. The first polygon of the given
  1599. ; Object is copied to begin with. If the given {\bf Operand} is NOT a geometric
  1600. ; object, but FALSE (numeric 0.0), a new polygon is created. Returns an (open)
  1601. ; object with this one polygon only and inside side of $+Z$. Note that if the
  1602. ; given polygon (first polygon of Object) is not on the $XY$ plane, it is transformed
  1603. ; to it before editing, and transformed back after.
  1604.    This feature is NOT implemented.
  1605. @\subsubsection{CRVLNDST}
  1606. !CRVLNDST
  1607. @\begin{verbatim}
  1608.  NumericType CRVLNDST( CurveType Crv, PointType PtOnLine, VectorType LnDir,
  1609.                                  NumericType IsMinDist, NumericType Epsilon )
  1610.  ListType CRVLNDST( CurveType Crv, PointType PtOnLine, VectorType LnDir,
  1611.                                 NumericType IsMinDist, NumericType Epsilon )
  1612. @\end{verbatim}
  1613.    Computes the closest (if {\bf IsMinDist} is TRUE, farthest if FALSE) point
  1614.  on {\bf Curve} to the line specified by {\bf PtOnLine} and {\bf LnDir} as a
  1615.  point on the line and a line direction.
  1616.    Since this operation is partially numeric, {\bf Epsilon} is used to set
  1617.  the needed accuracy. It returns the parameter value of the location on
  1618.  {\bf Crv} closest to the line.
  1619.    If, however, {\bf Epsilon} is negative, -{\bf Epsilon} is used instead,
  1620.  and all local extrema in the distance function are returned as a list
  1621.  (both minima and maxima).
  1622.    If the line and the curve intersect, the point of intersection is
  1623.  returned as the minimum.
  1624.  Example:
  1625. @\begin{verbatim}
  1626.     Param = CRVLNDST( Crv, linePt, lineVec, TRUE, 0.001 );
  1627. @\end{verbatim}
  1628.  finds the closest point on {\bf Crv} to the line defined by {\bf linePt}
  1629.  and {\bf lineVec}.
  1630. @\subsubsection{CRVPTDST}
  1631. !CRVPTDST
  1632. @\begin{verbatim}
  1633.  NumericType CRVPTDST( CurveType Crv, PointType Point, NumericType IsMinDist,
  1634.                                                          NumericType Epsilon )
  1635.  ListType CRVPTDST( CurveType Crv, PointType Point, NumericType IsMinDist,
  1636.                                                          NumericType Epsilon )
  1637. @\end{verbatim}
  1638.    Computes the closest (if {\bf IsMinDist} is TRUE, farthest if FALSE) point
  1639.  on {\bf Crv} to {\bf Point}.
  1640.    Since this operation is partially numeric, {\bf Epsilon} is used to set
  1641.  the needed accuracy. It returns the parameter value of the location on
  1642.  {\bf Crv} closest to {\bf Point}.
  1643.    If, however, {\bf Epsilon} is negative, -{\bf Epsilon} is used instead,
  1644.  and all local extrema in the distance function are returned as a list
  1645.  (both minima and maxima).
  1646.  Example:
  1647. @\begin{verbatim}
  1648.     Param = CRVPTDST( Crv, Pt, FALSE, 0.0001 ); 
  1649. @\end{verbatim}
  1650.  finds the farthest point on {\bf Crv} from point {\bf Pt}.
  1651. @\subsubsection{CSURFACE}
  1652. !CSURFACE
  1653. @\begin{verbatim}
  1654.  CurveType CSURFACE( SurfaceType Srf, ConstantType Direction,
  1655.                                                           NumericType Param )
  1656. @\end{verbatim}
  1657.    Extract an isoparametric curve out of {\bf Srf} in the specified
  1658.  {\bf Direction} (ROW or COL) at the specified parameter value {\bf Param}.
  1659.  {\bf Param} must be contained in the parametric domain of {\bf Srf} in
  1660.  {\bf Direction} direction.
  1661.  The returned curve is {\em in} the surface {\bf Srf}.
  1662. @It is equal to,
  1663. @\begin{equation}
  1664. @     C(t) = S(t, v_0) = \sum_{i=0}^m \sum_{j=0}^n P_{ij} B_i(t) B_j(v_0) =
  1665. @            \sum_{i=0}^m \left( \sum_{j=0}^n P_{ij} B_j(u_0) \right) B_i(t) =
  1666. @            \sum_{i=0}^m Q_i B_i(t),
  1667. @     \label{eqn-crv-from-srf}
  1668. @\end{equation}
  1669. @where $Q_i = \sum_{j=0}^n P_{ij} B_j(u_0)$ are the coefficients of the
  1670. @returned curve, and similar for the other parametric direction $S(u_0, t)$.
  1671. @{\bf param} is $v_0$ is equation~\eqnref{eqn-crv-from-srf}
  1672.  Example:
  1673. @\begin{verbatim}
  1674.     Crv = CSURFACE( Srf, COL, 0.15 ); 
  1675. @\end{verbatim}
  1676.  extracts an isoparametric curve in the COLumn direction at the parameter
  1677.  value of 0.15 from surface {\bf Srf}. See also CMESH, COMPOSE.
  1678. @\subsubsection{CTANGENT}
  1679. !CTANGENT
  1680. @\begin{verbatim}
  1681.  VectorType CTANGENT( CurveType Curve, NumericType Param )
  1682. @\end{verbatim}
  1683.    Computes the tangent vector to {\bf Curve} at the parameter value {\bf Param}.
  1684.    The returned vector has a unit length.
  1685.  Example:
  1686. @\begin{verbatim}
  1687.     Tang = CTANGENT( Crv, 0.5 );
  1688. @\end{verbatim}
  1689.  computes the tangent vector to {\bf Crv} at the parameter value of 0.5.
  1690. @\subsubsection{CTLPT}
  1691. !CTLPT
  1692. @\begin{verbatim}
  1693.  CPt = CTLPT( ConstantType PtType, NumericType Coord1, ... )
  1694. @\end{verbatim}
  1695.    Constructs a single control point to be used in the construction of curves
  1696.  and surfaces. Points can have from one to five dimensions, and may be
  1697.  either Euclidean or Projective (rational). Points' type is set via the
  1698.  constants E1 to E5 and P1 to P5. The coordinates of the point are specified
  1699.  in order, weight is first if rational.
  1700.  Examples:
  1701. @\begin{verbatim}
  1702.     CPt1 = CTLPT( E3, 0.0, 0.0, 0.0 );
  1703.     CPt2 = CTLPT( P2, 0.707, 1.414, 1.414 );
  1704. @\end{verbatim}
  1705.  constructs an {\bf E3} point at the origin and a P2 rational point with
  1706.  a weight of $0.707$.
  1707. @\subsubsection{CYLIN}
  1708. !CYLIN
  1709. @\begin{verbatim}
  1710.  PolylineType CYLIN( VectorType Center, VectorType Direction,
  1711.                      NumericType Radius )
  1712. @\end{verbatim}
  1713.    Creates a CYLINder geometric object, defined by {\bf Center} as center of
  1714.  the base of the CYLINder, {\bf Direction} as the CYLINder's axis and height,
  1715.  and {\bf Radius} as the radius of the base of the CYLINder.
  1716.    See RESOLUTION for the accuracy of the CYLINder approximation as a
  1717.  polygonal model.
  1718.  Example:
  1719. @\begin{verbatim}
  1720.     Cylinder1 = CYLIN( vector( 0, 0, 0 ), vector( 1, 0, 0 ), 10 );
  1721. @\end{verbatim}
  1722.  constructs a cylinder along the $X$ axis from the origin to $X = 10$.
  1723. @\subsubsection{CZEROS}
  1724. !CZEROS
  1725. @\begin{verbatim}
  1726.  ListType CZEROS( CurveType Crv, NumericType Epsilon, NumericType Axis )
  1727. @\end{verbatim}
  1728.    Computes the zero set of the given {\bf Crv} in the given axis (1 for X,
  1729.  2 for Y, 3 for Z). Since this computation is numeric, an {\bf Epsilon} is
  1730.  also required to specify the desired tolerance. It returns a list of
  1731.  all the parameter values (NumericType) the curve is zero.
  1732.  Example:
  1733. @\begin{verbatim}
  1734.     xzeros = CZEROS( cb, 0.001, 1 );
  1735.     pt_xzeros = nil();
  1736.     pt = nil();
  1737.     for ( i = 1, 1, listsize( xzeros ),
  1738.             pt = ceval( cb, nth( xzeros, i ) ):
  1739.             snoc( pt, pt_xzeros )
  1740.         );
  1741.     interact( list( axes, cb, pt_xzeros ), 0);
  1742. @\end{verbatim}
  1743.  Computes the {\bf X} zero set of curve {\bf cb} with error tolerance
  1744.  of {\bf 0.001}. This set is then scanned in a loop and evaluated to
  1745.  the curve's locations, which are then displayed.
  1746.  See also CINFLECT.
  1747. @\subsubsection{EXTRUDE}
  1748. !EXTRUDE
  1749. @\begin{verbatim}
  1750.  PolygonType EXTRUDE( PolygonType Object, VectorType Dir )
  1751.  SurfaceType EXTRUDE( CurveType Object, VectorType Dir )
  1752. @\end{verbatim}
  1753.    Creates an extrusion of the given {\bf Object}. If {\bf Object} is a
  1754.  PolygonObject, its first polygon is used as the base for the extrusion in
  1755.  {\bf Dir} direction, and a closed PolygonObject is constructed. If {\bf Object}
  1756.  is a CurveType, an extrusion surface is constructed instead, which is {\em not}
  1757.  a closed object (the two bases of the extrusion are excluded, and the curve
  1758.  may be open by itself).
  1759.    Direction {\bf Dir} cannot be coplanar with the polygon plane. The curve
  1760.  may be nonplanar.
  1761.  Example:
  1762. @\begin{verbatim}
  1763.     Cross = cbspline( 3,
  1764.                       list( ctlpt( E2, -0.018, 0.001 ),
  1765.                             ctlpt( E2,  0.018, 0.001 ),
  1766.                             ctlpt( E2,  0.019, 0.002 ),
  1767.                             ctlpt( E2,  0.018, 0.004 ),
  1768.                             ctlpt( E2, -0.018, 0.004 ),
  1769.                             ctlpt( E2, -0.019, 0.001 ) ),
  1770.                       list( KV_OPEN ) );
  1771.     Cross = Cross + -Cross * scale( vector( 1, -1, 1 ) );
  1772.     Napkin = EXTRUDE( Cross * scale( vector( 1.6, 1.6, 1.6 ) ),
  1773.                       vector( 0.02, 0.03, 0.2 ) );
  1774. @\end{verbatim}
  1775.  constructs a closed cross section {\bf Cross} by duplicating one half of
  1776.  it in reverse and merging the two sub-curves. {\bf Cross} is then used as
  1777.  the cross-section for the extrusion operation.
  1778. @\subsubsection{FFCOMPAT}
  1779. !FFCOMPAT
  1780. @\begin{verbatim}
  1781.  FFCOMAPT( CurveType Crv1, CurveType Crv2 )
  1782.  FFCOMAPT( SurfaceType Srf1, SurfaceType Srf2 )
  1783. @\end{verbatim}
  1784.  Makes the given two curves or surfaces compatible by making them share the
  1785.  same point type, same curve type, same degree, and the same continuity.
  1786.  Same point type is gained by promoting a lower dimension into a higher one,
  1787.  and non-rational to rational points. Bezier curves are promoted to Bspline
  1788.  curves if necessary, for curve type compatibility. Degree compatibility is
  1789.  achieved by raising the degree of the lower order curve. Continuity is
  1790.  achieve by refining both curves to the space with the same (unioned) knot
  1791.  vector. This function returns nothing and compatibility is made
  1792.  {\em in place}.
  1793.  Example:
  1794. @\begin{verbatim}
  1795.  FFCOMPAT( Srf1, Srf2 );
  1796. @\end{verbatim}
  1797.  See also SMORPH.
  1798. @\subsubsection{GBOX}
  1799. !GBOX
  1800. @\begin{verbatim}
  1801.  PolygonType GBOX( VectorType Point,
  1802.                    VectorType Dx, VectorType Dy, VectorType Dz )
  1803. @\end{verbatim}
  1804.    Creates a parallelepiped - Generalized BOX polygonal object, defined by
  1805.  {\bf Point} as base position, and {\bf Dx, Dy, Dz} as 3 3D vectors to define
  1806.  the 6 faces of this generalized BOX. The regular BOX object is a special case
  1807.  of GBOX where {\bf Dx} = vector(Dx, 0, 0), {\bf Dy} = vector(0, Dy, 0), and
  1808.  {\bf Dz} = vector(0, 0, Dz).
  1809.    {\bf Dx}, {\bf Dy}, {\bf Dz} must all be independent in order to create an
  1810.  object with positive volume.
  1811.  Example:
  1812. @\begin{verbatim}
  1813.     GB = GBOX(vector(0.0, -0.35, 0.63), vector(0.5, 0.0, 0.5),
  1814.                                         vector(-0.5, 0.0, 0.5),
  1815.                                         vector(0.0, 0.7, 0.0));
  1816. @\end{verbatim}
  1817. @\subsubsection{GPOLYGON}
  1818. !GPOLYGON
  1819. @\begin{verbatim}
  1820.  PolygonType GPOLYGON( GeometryTreeType Object )
  1821. @\end{verbatim}
  1822.    Approximates all Surface(s) in {\bf Object} with polygons using the
  1823.  RESOLUTION and FLAT4PLY variables. The larger the RESOLUTION is, the finer
  1824.  (more polygons) the resulting approximation will be.
  1825.    FLAT4PLY is a Boolean flag controlling the conversion of an (almost) flat
  1826.  patch into four (TRUE) or two (FALSE) polygons. Normals are computed to
  1827.  polygon vertices using surface normals, so Gouraud or Phong shading can be
  1828.  exploited. It returns a single polygonal object.
  1829.  Example:
  1830. @\begin{verbatim}
  1831.     Polys = GPOLYGON( list( Srf1, Srf2, Srf3 ) );
  1832. @\end{verbatim}
  1833.  Converts to polygons the three surfaces {\bf Srf1}, {\bf Srf2}, and {\bf Srf3}.
  1834. @\subsubsection{GPOLYLINE}
  1835. !GPOLYLINE
  1836. @\begin{verbatim}
  1837.  PolylineType GPOLYLINE( GeometryTreeType Object )
  1838. @\end{verbatim}
  1839.    Converts all Surface(s) and Curves(s) in {\bf Object} into polylines using
  1840.  the RESOLUTION variable. The larger the RESOLUTION is, the finer the resulting
  1841.  approximation will be. It returns a single polyline object.
  1842.  Example:
  1843. @\begin{verbatim}
  1844.     Polys = GPOLYLINE( list( Srf1, Srf2, Srf3, list( Crv1, Crv2, Crv3 ) ) );
  1845. @\end{verbatim}
  1846.  converts to polylines the three surfaces {\bf Srf1}, {\bf Srf2}, and {\bf Srf3}
  1847.  and the three curves {\bf Crv1}, {\bf Crv2}, and {\bf Crv3}.
  1848. @\subsubsection{NIL}
  1849. @\begin{verbatim}
  1850.  ListType NIL()
  1851. @\end{verbatim}
  1852.    Creates an empty list so data can be accumulated in it.
  1853.  See CINFLECT or CZEROS for examples. See also LIST and SNOC.
  1854. @\subsubsection{MERGPOLY}
  1855. !MERGEPOLY
  1856. @\begin{verbatim}
  1857.  PolygonType MERGEPOLY( ListType PolyList )
  1858. @\end{verbatim}
  1859.  Merges a set of polygonal objects in {\bf PolyList} list to a single polygonal
  1860.  object. All elements in {\bf ObjectList} must be of PolygonType type. This
  1861.  function performs the same operation as the overloaded {\bf \verb+^+} operator
  1862.  would, but might be more convenient to use under some circumstances.
  1863.  Example:
  1864. @\begin{verbatim}
  1865.     Vrtx1 = vector( -3, -2, -1 );
  1866.     Vrtx2 = vector( 3, -2, -1 );
  1867.     Vrtx3 = vector( 3, 2, -1 );
  1868.     Vrtx4 = vector( -3, 2, -1 );
  1869.     Poly1 = poly( list( Vrtx1, Vrtx2, Vrtx3, Vrtx4 ) ); 
  1870.     Vrtx1 = vector( -3, 2, 1 );
  1871.     Vrtx2 = vector( 3, 2, 1 );
  1872.     Vrtx3 = vector( 3, -2, 1 );
  1873.     Vrtx4 = vector( -3, -2, 1 );
  1874.     Poly2 = poly( list( Vrtx1, Vrtx2, Vrtx3, Vrtx4 ) );
  1875.     Vrtx1 = vector( -3, -2, 1 );
  1876.     Vrtx2 = vector( 3, -2, 1 );
  1877.     Vrtx3 = vector( 3, -2, -1 );
  1878.     Vrtx4 = vector( -3, -2, -1 );
  1879.     Poly3 = poly( list( Vrtx1, Vrtx2, Vrtx3, Vrtx4 ) );
  1880.     PolyObj = MERGEPOLY( list( Poly1, Poly2, Poly3 ) );
  1881. @\end{verbatim}
  1882. @\subsubsection{OFFSET}
  1883. !OFFSET
  1884. @\begin{verbatim}
  1885.  CurveType OFFSET( CurveType Crv, NumericType OffsetDistance )
  1886.  SurfaceType OFFSET( SurfaceType Srf, NumericType OffsetDistance )
  1887. @\end{verbatim}
  1888.  Offsets {\bf Crv} or {\bf Srf}, by translating all the control points in the
  1889.  direction of the normal of the curve or surface by an {\bf OffsetDistance}
  1890.  amount. Each control point has a {\em node} parameter value associated with
  1891.  it, which is used to compute the normal. The returned curve or surface only
  1892.  approximates the real offset. One may improve the offset accuracy using
  1893.  refinement (See AOFFSET). Negative {\bf OffsetDistance} denotes offset in
  1894.  the reversed direction of the normal.
  1895.  Example:
  1896. @\begin{verbatim}
  1897.     OffCrv = OFFSET( Crv, -0.1 );
  1898. @\end{verbatim}
  1899.  offsets {\bf Crv} by the amount of $-0.1$ in the reversed normal direction.
  1900.  See also AOFFSET.
  1901. @\subsubsection{PDOMAIN}
  1902. !PDOMAIN
  1903. @\begin{verbatim}
  1904.  ListType PDOMAIN( CurveType Crv )
  1905.  ListType PDOMAIN( SurfaceType Srf )
  1906. @\end{verbatim}
  1907.    Returns the parametric domain of the curve (TMin, TMax) or of a surface
  1908.  (UMin, UMax, VMin, VMax) as a list object.
  1909.  Example:
  1910. @\begin{verbatim}
  1911.  circ_domain = PDOMAIN( circle( vector( 0.0, 0.0, 0.0 ), 1.0 ) );
  1912. @\end{verbatim}
  1913. @\subsubsection{POLY}
  1914. !POLY
  1915. @\begin{verbatim}
  1916.  PolygonType POLY( ListType VrtxList, NumericType IsPolyline )
  1917. @\end{verbatim}
  1918.    Creates a single polygon/polyline (and therefore open) object, defined by
  1919.  the vertices in {\bf VrtxList} (see LIST). All elements in {\bf VrtxList}
  1920.  must be of VectorType type. If {\bf IsPolyline}, a polyline is created,
  1921.  otherwise a polygon.
  1922.  Example:
  1923. @\begin{verbatim}
  1924.     V1  = vector( 0.0, 0.0, 0.0 );
  1925.     V2  = vector( 0.3, 0.0, 0.0 );
  1926.     V3  = vector( 0.3, 0.0, 0.1 );
  1927.     V4  = vector( 0.2, 0.0, 0.1 );
  1928.     V5  = vector( 0.2, 0.0, 0.5 );
  1929.     V6  = vector( 0.3, 0.0, 0.5 );
  1930.     V7  = vector( 0.3, 0.0, 0.6 );
  1931.     V8  = vector( 0.0, 0.0, 0.6 );
  1932.     V9  = vector( 0.0, 0.0, 0.5 );
  1933.     V10 = vector( 0.1, 0.0, 0.5 );
  1934.     V11 = vector( 0.1, 0.0, 0.1 );
  1935.     V12 = vector( 0.0, 0.0, 0.1 );
  1936.     I = POLY( list( V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12 ),
  1937.               FALSE );
  1938. @\end{verbatim}
  1939.  constructs an object with a single polygon in the shape of the letter I.
  1940. @\subsubsection{PRISA}
  1941. !PRISA
  1942. @\begin{verbatim}
  1943.  ListType PRISA( SurfaceType Srfs, NumericType SamplesPerCurve,
  1944.                  NumericType Epsilon, ConstantType Dir, VectorType Space )
  1945. @\end{verbatim}
  1946.    Computes a layout (prisa) of the given surface(s) {\bf Srfs}, and returns
  1947.  a list of surface objects representing the layout.
  1948.    The surface is approximated to within {\bf Epsilon} in direction {\bf Dir}
  1949.  into a set of ruled surfaces and then developable surfaces that are laid out
  1950.  flat onto the $XY$ plane. If {\bf Epsilon} is negative, the piecewise ruled
  1951.  surface approximation in 3-space is returned. 
  1952.    {\bf SamplesPerCurve} controls the piecewise linear approximation of the
  1953.  boundary of the ruled/developable surfaces. {\bf Space} is a vector whose
  1954.  X component controls the space between the different surfaces' layout, and
  1955.  whose Y component controls the space between different layout pieces.
  1956.  Example:
  1957. @\begin{verbatim}
  1958.  cross = cbspline( 3,
  1959.                    list( ctlpt( E3, 0.7, 0.0, 0. ),
  1960.                          ctlpt( E3, 0.7, 0.0, 0.06 ),
  1961.                          ctlpt( E3, 0.1, 0.0, 0.1 ),
  1962.                          ctlpt( E3, 0.1, 0.0, 0.6 ),
  1963.                          ctlpt( E3, 0.6, 0.0, 0.6 ),
  1964.                          ctlpt( E3, 0.8, 0.0, 0.8 ),
  1965.                          ctlpt( E3, 0.8, 0.0, 1.4 ),
  1966.                          ctlpt( E3, 0.6, 0.0, 1.6 ) ),
  1967.                    list( KV_OPEN ) );
  1968.  wglass = surfrev( cross );
  1969.  wgl_ruled = PRISA( wglass, 6, -0.1, COL, vector( 0, 0.25, 0.0 ) );
  1970.  wgl_prisa = PRISA( wglass, 6, 0.1, COL, vector( 0, 0.25, 0.0 ) );
  1971. @\end{verbatim}
  1972.  Computes a layout of a wine glass in {\bf wgl\_prisa} and a three-dimensional
  1973.  ruled surface approximation of wglass in {\bf wgl\_ruled}.
  1974. @\subsubsection{RULEDSRF}
  1975. !RULEDSRF
  1976. @\begin{verbatim}
  1977.  SurfaceType RULEDSRF( CurveType Crv1, CurveType Crv2 )
  1978. @\end{verbatim}
  1979.    Constructs a ruled surface between the two curves {\bf Crv1} and {\bf Crv2}.
  1980.    The curves do not have to have the same order or type, and will be promoted
  1981.  to their least common denominator.
  1982.  Example:
  1983. @\begin{verbatim}
  1984.     Circ = circle( vector( 0.0, 0.0, 0.0 ), 0.25 );
  1985.     Cyl = RULEDSRF( circ, circ * trans( vector( 0.0, 0.0, 1.0 ) ) );
  1986. @\end{verbatim}
  1987.  Constructs a cylinder of radius 0.25 along the Z axis from 0 to 1.
  1988. @\subsubsection{SBEZIER}
  1989. !SBEZIER
  1990. @\begin{verbatim}
  1991.  SurfaceType SBEZIER( ListType CtlMesh )
  1992. @\end{verbatim}
  1993.    Creates a Bezier surface using the provided control mesh. {\bf CtlMesh} is a
  1994.  list of rows, each of which is a list of control points. All control points
  1995.  must be of the same point type.
  1996. @The created surface is the piecewise polynomial (or rational) surface,
  1997. @\begin{equation}
  1998. @     S(u, v) = \sum_{i=0}^m \sum_{j=0}^n P_{ij} B_i(u) B_j(v)
  1999. @\end{equation}
  2000. @where $P_{ij}$ are the control points {\bf CtlMesh}. and $m$ and $n$ are the
  2001. @degrees of the surface, which are one less than the number of points in the
  2002. @appropriate direction.
  2003.  Example:
  2004. @\begin{verbatim}
  2005.    Srf = SBEZIER( list ( list( ctlpt( E3, 0.0, 0.0, 1.0 ),
  2006.                                ctlpt( E3, 0.0, 1.0, 0.0 ),
  2007.                                ctlpt( E3, 0.0, 2.0, 1.0 ) ),
  2008.                          list( ctlpt( E3, 1.0, 0.0, 0.0 ),
  2009.                                ctlpt( E3, 1.0, 1.0, 2.0 ),
  2010.                                ctlpt( E3, 1.0, 2.0, 0.0 ) ),
  2011.                          list( ctlpt( E3, 2.0, 0.0, 2.0 ),
  2012.                                ctlpt( E3, 2.0, 1.0, 0.0 ),
  2013.                                ctlpt( E3, 2.0, 2.0, 2.0 ) ),
  2014.                          list( ctlpt( E3, 3.0, 0.0, 0.0 ),
  2015.                                ctlpt( E3, 3.0, 1.0, 2.0 ),
  2016.                                ctlpt( E3, 3.0, 2.0, 0.0 ) ),
  2017.                          list( ctlpt( E3, 4.0, 0.0, 1.0 ),
  2018.                                ctlpt( E3, 4.0, 1.0, 0.0 ),
  2019.                                ctlpt( E3, 4.0, 2.0, 1.0 ) ) ) );
  2020. @\end{verbatim}
  2021. @\subsubsection{SBSPLINE}
  2022. !SBSPLINE
  2023. @\begin{verbatim}
  2024.  SurfaceType SBSPLINE( NumericType UOrder, NumericType VOrder,
  2025.                        ListType CtlMesh, ListType KnotVectors )
  2026. @\end{verbatim}
  2027.    Creates a Bspline surface from the provided {\bf UOrder} and {\bf VOrder}
  2028.  orders, the control mesh {\bf CtlMesh}, and the two knot vectors {\bf KnotVectors}.
  2029.  {\bf CtlMesh} is a list of rows, each of which is a list of control points.
  2030.  All control points must be of the same point type. {\bf KnotVectors} is a
  2031.  list of two knot vectors. Each knot vector is a list of NumericType knots or a
  2032.  list of a single constant KV\_OPEN or KV\_FLOAT, in which a uniform knot
  2033.  vector with the appropriate length and with open or floating end condition
  2034.  will be constructed automatically.
  2035. @The created surface is the piecewise polynomial (or rational) surface,
  2036. @\begin{equation}
  2037. @     S(u, v) = \sum_{i=0}^m \sum_{j=0}^n P_{ij} B_{i,\chi}(u) B_{j,\xi}(v)
  2038. @\end{equation}
  2039. @where $P_{ij}$ are the control points {\bf CtlMesh}, and $m$ and $n$ are the
  2040. @degrees of the surface, which are one less than {\bf UOrder} and {\bf VOrder}.
  2041. @$\chi$ and $\xi$ are the two knot vectors of the surface.
  2042.  Example:
  2043. @\begin{verbatim}
  2044.     Mesh = list ( list( ctlpt( E3, 0.0, 0.0, 1.0 ),
  2045.                         ctlpt( E3, 0.0, 1.0, 0.0 ),
  2046.                         ctlpt( E3, 0.0, 2.0, 1.0 ) ),
  2047.                   list( ctlpt( E3, 1.0, 0.0, 0.0 ),
  2048.                         ctlpt( E3, 1.0, 1.0, 2.0 ),
  2049.                         ctlpt( E3, 1.0, 2.0, 0.0 ) ),
  2050.                   list( ctlpt( E3, 2.0, 0.0, 2.0 ),
  2051.                         ctlpt( E3, 2.0, 1.0, 0.0 ),
  2052.                         ctlpt( E3, 2.0, 2.0, 2.0 ) ),
  2053.                   list( ctlpt( E3, 3.0, 0.0, 0.0 ),
  2054.                         ctlpt( E3, 3.0, 1.0, 2.0 ),
  2055.                         ctlpt( E3, 3.0, 2.0, 0.0 ) ),
  2056.                   list( ctlpt( E3, 4.0, 0.0, 1.0 ),
  2057.                         ctlpt( E3, 4.0, 1.0, 0.0 ),
  2058.                         ctlpt( E3, 4.0, 2.0, 1.0 ) ) );
  2059.     Srf = SBSPLINE( 3, 3, Mesh, list( list( KV_OPEN ),
  2060.                                       list( 3, 3, 3, 4, 5, 6, 6, 6 ) ) );
  2061. @\end{verbatim}
  2062.  constructs a bi-quadratic Bspline surface with its first knot vector
  2063.  having uniform knot spacing with open end conditions.
  2064. @\subsubsection{SDERIVE}
  2065. !SDERIVE
  2066. @\begin{verbatim}
  2067.  SurfaceType SDERIVE( SurfaceType Srf, NumericType Dir )
  2068. @\end{verbatim}
  2069.    Returns a vector field surface representing the differentiated surface
  2070.  in the given direction (ROW or COL). Evaluation of the returned surface at
  2071.  a given parameter value will return a vector {\em tangent} to {\bf Srf} in
  2072.  {\bf Dir} at that parameter value.
  2073. @\begin{verbatim}
  2074.  DuSrf = SDERIVE( Srf, ROW );
  2075.  DvSrf = SDERIVE( Srf, COL );
  2076.  Normal = coerce( seval( DuSrf, 0.5, 0.5 ), VECTOR_TYPE ) ^
  2077.           coerce( seval( DvSrf, 0.5, 0.5 ), VECTOR_TYPE );
  2078. @\end{verbatim}
  2079.  computes the two partial derivatives of the surface {\bf Srf} and computes
  2080.  its normal as their cross product, at the parametric location (0.5, 0.5).
  2081. @\subsubsection{SDIVIDE}
  2082. !SDIVIDE
  2083. @\begin{verbatim}
  2084.  SurfaceType SDIVIDE( SurfaceType Srf, ConstantType Direction,
  2085.                                                           NumericType Param )
  2086. @\end{verbatim}
  2087.    Subdivides a surface into two at the specified parameter value {\bf Param}
  2088.  in the specified {\bf Direction} (ROW or COL). {\bf Srf} can be either a Bspline
  2089.  surface in which {\bf Param} must be conatined in the parametric domain of the
  2090.  surface, or a Bezier surface in which {\bf Param} must be in the range of zero
  2091.  to one.
  2092.    It returns a list of the two sub-surfaces. The individual surfaces may be
  2093.  extracted from the list using the {\bf NTH} command.
  2094.  Example:
  2095. @\begin{verbatim}
  2096.     SrfLst = SDIVIDE( Srf, ROW, 0.5 );
  2097.     Srf1 = nth( SrfLst, 1 );
  2098.     Srf2 = nth( SrfLst, 2 );
  2099. @\end{verbatim}
  2100.  subdivides {\bf Srf} at the parameter value of 0.5 in the ROW direction.
  2101. @\subsubsection{SEDITPT}
  2102. !SEDITPT
  2103. @\begin{verbatim}
  2104.  SurfaceType SEDITPT( SurfaceType Srf, CtlPtType CPt, NumericType UIndex,
  2105.                                                       NumericType VIndex )
  2106. @\end{verbatim}
  2107.    Provides a simple mechanism to manually modify a single control point number
  2108.  {\bf UIndex} and {\bf VIndex} (base count is 0) in the control mesh of {\bf Srf}
  2109.  by substituting {\bf CtlPt} instead. CtlPt must have the same point type as
  2110.  the control points of {\bf Srf}. Original surface {\bf Srf} is not modified.
  2111.  Example:
  2112. @\begin{verbatim}
  2113.     CPt = ctlpt( E3, 1, 2, 3 );
  2114.     NewSrf = SEDITPT( Srf, CPt, 0, 0 );
  2115. @\end{verbatim}
  2116.  constructs a {\bf NewSrf} with the first control point of {\bf Srf} being
  2117.  {\bf CPt}.
  2118. @\subsubsection{SEVAL}
  2119. !SEVAL
  2120. @\begin{verbatim}
  2121.  CtlPtType SEVAL( SurfaceType Srf, NumericType UParam, NumericType VParam )
  2122. @\end{verbatim}
  2123.    Evaluates the provided surface {\bf Srf} at the given {\bf UParam} and
  2124.  {\bf VParam} values. Both {\bf UParam} and {\bf VParam} should be contained
  2125.  in the surface parametric domain if {\bf Srf} is a Bspline surface, or
  2126.  between zero and one if {\bf Srf} is a Bezier surface. The returned control
  2127.  point has the same type as the control points of {\bf Srf}.
  2128.  Example:
  2129. @\begin{verbatim}
  2130.     CPt = SEVAL( Srf, 0.25, 0.22 );
  2131. @\end{verbatim}
  2132.  evaluates {\bf Srf} at the parameter values of (0.25, 0.22).
  2133. @\subsubsection{SFROMCRVS}
  2134. !SFROMCRVS
  2135. @\begin{verbatim}
  2136.  SurfaceType SFROMCRVS( ListType CrvList, NumericType OtherOrder )
  2137. @\end{verbatim}
  2138.    Constructs a surface by substituting the curves in {\bf CrvList} as rows
  2139.  in a control mesh of a surface. Curves in {\bf CrvList} are made compatible
  2140.  by promoting Bezier curves to Bsplines if necessary, and raising degree
  2141.  and refining as required before substituting the control polygons of the
  2142.  curves as rows in the mesh. The other direction order is set by
  2143.  {\bf OtherOrder}, which cannot be larger than the number of curves.
  2144.    The surface interpolates the first and last curves only.
  2145.  Example:
  2146. @\begin{verbatim}
  2147.     Crv1 = cbspline( 3,
  2148.                      list( ctlpt( E3, 0.0, 0.0, 0.0 ),
  2149.                            ctlpt( E3, 1.0, 0.0, 0.0 ),
  2150.                            ctlpt( E3, 1.0, 1.0, 0.0 ) ),
  2151.                      list( KV_OPEN ) );
  2152.     Crv2 = Crv1 * trans( vector( 0.0, 0.0, 1.0 ) );
  2153.     Crv3 = Crv2 * scale( vector( 0.0, 0.0, 2.0 ) )
  2154.                 * trans( vector( 0.1, 0.1, 0.1 ) );
  2155.     Srf = SFROMCRVS( list( Crv1, Crv2, Crv3 ), 3 );
  2156. @\end{verbatim}
  2157. @\subsubsection{SMERGE}
  2158. !SMERGE
  2159. @\begin{verbatim}
  2160.  SurfaceType SMERGE( SurfaceType Srf1, SurfaceType Srf2,
  2161.                      NumericType Dir, NumericType SameEdge )
  2162. @\end{verbatim}
  2163.  Merges two surfaces along the requested direction (ROW or COL). If
  2164.  SameEdge is non-zero (ON or TRUE), then the common edge is assumed to be
  2165.  identical and copied only once. Otherwise (OFF or FALSE), a ruled surface
  2166.  is constructed between the two surfaces along the (not) common edge.
  2167.  Example:
  2168. @\begin{verbatim}
  2169.  MergedSrf = SMERGE( Srf1, Srf2, ROW, TRUE );
  2170. @\end{verbatim}
  2171. @\subsubsection{SMORPH}
  2172. !SMORPH
  2173. @\begin{verbatim}
  2174.  SurfaceType SMORPH( SurfaceType Srf1, SurfaceType Srf2, NumericType Blend )
  2175. @\end{verbatim}
  2176.  Creates a new surface which is a {\em convex blend} of the two given surfaces.
  2177.  The two given surfaces must be compatible (see FFCOMPAT) before this blend
  2178.  is invoked. Very useful if a sequence that "morphs" one surface to another
  2179.  is to be created.
  2180.  Example:
  2181. @\begin{verbatim}
  2182.  for ( i = 0.0, 1.0, 11.0,
  2183.         Msrf = SMORPH( Srf1, Srf2, i / 11.0 ):
  2184.         color( Msrf, white ):
  2185.         attrib( Msrf, "rgb", "255,255,255" ):
  2186.         attrib( Msrf, "reflect", 0.7 ):
  2187.         save( "morp1-" + i, Msrf )
  2188. @\end{verbatim}
  2189.  creates a sequence of 12 surfaces, morphed from {\bf Srf1} to {\bf Srf2}
  2190.  and saves them in the files "morph-0.dat" to "morph-11.dat".
  2191. @\subsubsection{SNORMAL}
  2192. !SNORMAL
  2193. @\begin{verbatim}
  2194.  VectorType SNORMAL( SurfaceType Srf, NumericType UParam, NumericType VParam )
  2195. @\end{verbatim}
  2196.    Computes the normal vector to {\bf Srf} at the parameter values {\bf UParam}
  2197.  and {\bf VParam}. The returned vector has a unit length.
  2198.  Example:
  2199. @\begin{verbatim}
  2200.     Normal = SNORMAL( Srf, 0.5, 0.5 );
  2201. @\end{verbatim}
  2202.  computes the normal to {\bf Srf} at the parameter values (0.5, 0.5).
  2203.  See also SNRMLSRF.
  2204. @\subsubsection{SNRMLSRF}
  2205. !SNRMLSRF
  2206. @\begin{verbatim}
  2207.  SurfaceType SNRMLSRF( SurfaceType Srf )
  2208. @\end{verbatim}
  2209.  Symbolically computes a vector field surface representing the non-normalized
  2210.  normals of the given surface. That is the normal surface, evaluated at
  2211.  $(u, v)$, provides a vector in the direction of the normal of the original
  2212.  surface at $(u, v)$. The normal surface is computed as the symbolic cross
  2213.  product of the two surfaces representing the partial derivatives of the
  2214.  original surface.
  2215.  Example:
  2216. @\begin{verbatim}
  2217.  NrmlSrf = SNRMLSRF( Srf );
  2218. @\end{verbatim}
  2219. @\subsubsection{SPHERE}
  2220. !SPHERE
  2221. @\begin{verbatim}
  2222.  PolygonType SPHERE( VectorType Center, NumericType Radius )
  2223. @\end{verbatim}
  2224.    Creates a SPHERE geometric object, defined by {\bf Center} as the center of
  2225.  the SPHERE, and with {\bf Radius} as the radius of the SPHERE.
  2226.    See RESOLUTION for accuracy of SPHERE approximation as a polygonal model. 
  2227. @\subsubsection{SRAISE}
  2228. !SRAISE
  2229. @\begin{verbatim}
  2230.  SurfaceType SRAISE( SurfaceType Srf, ConstantType Direction,
  2231.                                                       NumericType NewOrder )
  2232. @\end{verbatim}
  2233.    Raises {\bf Srf} to the specified {\bf NewOrder} in the specified
  2234.  {\bf Direction}.
  2235.  Example:
  2236. @\begin{verbatim}
  2237.     Srf = ruledSrf( cbezier( list( ctlpt( E3, -0.5, -0.5, 0.0 ),
  2238.                                    ctlpt( E3,  0.5, -0.5, 0.0 ) ) ),
  2239.                     cbezier( list( ctlpt( E3, -0.5,  0.5, 0.0 ),
  2240.                                    ctlpt( E3,  0.5,  0.5, 0.0 ) ) ) );
  2241.     Srf = SRAISE( SRAISE( Srf, ROW, 3 ), COL, 3 );
  2242. @\end{verbatim}
  2243.  constructs a bilinear flat ruled surface and raises both its directions to be
  2244.  a bi-quadratic surface.
  2245. @\subsubsection{SREFINE}
  2246. !SREFINE
  2247. @\begin{verbatim}
  2248.  SurfaceType SREFINE( SurfaceType Srf, ConstantType Direction,
  2249.                       NumericType Replace, ListType KnotList )
  2250. @\end{verbatim}
  2251.    Provides the ability to {\bf Replace} a knot vector of {\bf Srf} or refine 
  2252.  it in the specified direction {\bf Direction} (ROW or COL).
  2253.    {\bf KnotList} is a list of knots to refine {\bf Srf} at. All knots should be
  2254.  contained in the parametric domain of {\bf Srf} in {\bf Direction}. If the knot
  2255.  vector is replaced, the length of {\bf KnotList} should be identical to the
  2256.  length of the original knot vector of {\bf Srf} in {\bf Direction}. If {\bf Srf}
  2257.  is a Bezier surface, it is automatically promoted to be a Bspline surface.
  2258.  Example:
  2259. @\begin{verbatim}
  2260.     Srf = SREFINE( SREFINE( Srf,
  2261.                             ROW, FALSE, list( 0.333, 0.667 ) ),
  2262.                    COL, FALSE, list( 0.333, 0.667 ) );
  2263. @\end{verbatim}
  2264.  refines {\bf Srf} in both directions by adding two more knots at 0.333 and
  2265.  0.667
  2266. @\subsubsection{SREGION}
  2267. !SREGION
  2268. @\begin{verbatim}
  2269.  SurfaceType SREGION( SurfaceType Srf, ConstantType Direction,
  2270.                                                         NumericType NewOrder )
  2271. @\end{verbatim}
  2272.    Extracts a region of {\bf Srf} between {\bf MinParam} and {\bf MaxParam}
  2273.  in the specified {\bf Direction}. Both {\bf MinParam} and {\bf MaxParam}
  2274.  should be contained in the parametric domain of {\bf Srf} in {\bf Direction}.
  2275.  Example:
  2276. @\begin{verbatim}
  2277.     SubSrf = SREGION( Srf, COL, 0.3, 0.6 );
  2278. @\end{verbatim}
  2279.  extracts the region of {\bf Srf} from the parameter value 0.3 to the
  2280.  parameter value 0.6 along the COLumn direction. the ROW direction is
  2281.  extracted as a whole.
  2282. @\subsubsection{STANGENT}
  2283. !STANGENT
  2284. @\begin{verbatim}
  2285.  VectorType STANGENT( SurfaceType Srf, ConstantType Direction,
  2286.                       NumericType UParam, NumericType VParam )
  2287. @\end{verbatim}
  2288.    Computes the tangent vector to {\bf Srf} at the parameter values {\bf UParam}
  2289.  and {\bf VParam} in {\bf Direction}. The returned vector has a unit length.
  2290.  Example:
  2291. @\begin{verbatim}
  2292.     Tang = STANGENT( Srf, ROW, 0.5, 0.6 );
  2293. @\end{verbatim}
  2294.  computes the tangent to {\bf Srf} in the ROW direction at the parameter
  2295.  values (0.5, 0.6).
  2296. @\subsubsection{SURFREV}
  2297. !SURFREV
  2298. @\begin{verbatim}
  2299.  PolygonType SURFREV( PolygonType Object )
  2300.  SurfaceType SURFREV( CurveType Object )
  2301. @\end{verbatim}
  2302.    Creates a surface of revolution by rotating the first polygon/curve of the
  2303.  given {\bf Object}, around the Z axis. Use the linear transformation function
  2304.  to position a surface of revolution in a different orientation.
  2305.  Example:
  2306. @\begin{verbatim}
  2307.     VTailAntn = SURFREV( ctlpt( E3, 0.001, 0.0, 1.0 ) +
  2308.                          ctlpt( E3, 0.01,  0.0, 1.0 ) +
  2309.                          ctlpt( E3, 0.01,  0.0, 0.8 ) +
  2310.                          ctlpt( E3, 0.03,  0.0, 0.7 ) +
  2311.                          ctlpt( E3, 0.03,  0.0, 0.3 ) +
  2312.                          ctlpt( E3, 0.001, 0.0, 0.0 ) );
  2313. @\end{verbatim}
  2314.  constructs a piecewise linear Bspline curve in the XZ plane and uses it to
  2315.  construct a surface of revolution by rotating it around the Z axis.
  2316. @\subsubsection{SWEEPSRF}
  2317. !SWEEPSRF
  2318. @\begin{verbatim}
  2319.  SurfaceType SWEEPSRF( CurveType CrossSection, CurveType Axis,
  2320.                      NumericType Scale | CurveType ScaleCrv,
  2321.                      CurveType FrameCrv | VectorType FrameVec | ConstType OFF )
  2322. @\end{verbatim}
  2323.    Constructs a generalized cylinder surface. This function sweeps a specified
  2324.  cross-section {\bf CrossSection} along the provided {\bf Axis}.
  2325.  The cross-section may be scaled by a constant value {\bf Scale}, or scaled
  2326.  along the {\bf Axis} parametric direction via a scaling curve {\bf ScaleCrv}.
  2327.    By default, when frame specification is {\bf OFF}, the orientation
  2328.  of the cross section is computed using the {\bf Axis} curve tangent and
  2329.  normal. However, unlike the Frenet frame, attempt is made to minimize
  2330.  the normal change, as can happen along inflection points in {\bf Axis}.
  2331.    If a VectorType {\bf FrameVec} is provided as a frame orientation setting,
  2332.  it is used to fix the normal direction to this value. In other words, the
  2333.  orientation frame has a fixed normal. If a CurveType {\bf FrameCrv} is
  2334.  specified as a frame orientation setting, this vector field curve is
  2335.  evaluated at each placement of the cross-section to yield the needed normal.
  2336.    The resulting sweep is only an approximation of the real sweep. The
  2337.  scaling and axis placement will not be exact, in general.
  2338.    Refinement of the axis curve at the proper location, where accuracy is
  2339.  important, should improve the accuracy of the output. The parametric domains
  2340.  of {\bf ScaleCrv} and {\bf FrameCrv} do not have to match the parametric
  2341.  domain of {\bf Axis}, and their domains are made compatible by this function.
  2342.  Example:
  2343. @\begin{verbatim}
  2344.     Cross = arc( vector( 0.2, 0.0, 0.0 ),
  2345.                  vector( 0.2, 0.2, 0.0 ),
  2346.                  vector( 0.0, 0.2, 0.0 ) ) +
  2347.             arc( vector( 0.0, 0.4, 0.0 ),
  2348.                  vector( 0.1, 0.4, 0.0 ),
  2349.                  vector( 0.1, 0.5, 0.0 ) ) +
  2350.             arc( vector( 0.8, 0.5, 0.0 ),
  2351.                  vector( 0.8, 0.3, 0.0 ),
  2352.                  vector( 1.0, 0.3, 0.0 ) ) +
  2353.             arc( vector( 1.0, 0.1, 0.0 ),
  2354.                  vector( 0.9, 0.1, 0.0 ),
  2355.                  vector( 0.9, 0.0, 0.0 ) ) +
  2356.             ctlpt( E2, 0.2, 0.0 );
  2357.     Axis = arc( vector( -1.0, 0.0, 0.0 ),
  2358.                 vector(  0.0, 0.0, 0.1 ),
  2359.                 vector(  1.0, 0.0, 0.0 ) );
  2360.     Axis = crefine( Axis, FALSE, list( 0.25, 0.5, 0.75 ) );
  2361.     ScaleCrv = cbezier( list( ctlpt( E2, 0.0, 0.01 ),
  2362.                               ctlpt( E2, 1.0, 0.5 ),
  2363.                               ctlpt( E2, 2.0, 0.01 ) ) );
  2364.     Srf1 = SWEEPSRF( Cross, Axis, ScaleCrv, OFF );
  2365.     Srf2 = SWEEPSRF( Cross, Axis, ScaleCrv, vector( 0.0, 1.0, 1.0 ) );
  2366.     Srf3 = SWEEPSRF( Cross, Axis, ScaleCrv,
  2367.                      cbezier( list( ctlpt( E3,  1.0, 0.0, 0.0 ),
  2368.                                     ctlpt( E3,  0.0, 1.0, 0.0 ),
  2369.                                     ctlpt( E3, -1.0, 0.0, 0.0 ) ) ) );
  2370. @\end{verbatim}
  2371.  constructs a rounded rectangle cross-section and sweeps it along an arc, while
  2372.  scaling and orienting in several ways. The axis curve {\bf Axis} is
  2373.  manually refined to better approximate the requested scaling.
  2374. @\subsubsection{SYMBPROD}
  2375. !SYMBPROD
  2376. @\begin{verbatim}
  2377.  CurveType SYMBPROD( CurveType Crv1, CurveType Crv2 )
  2378.  SurfaceType SYMBPROD( SurfaceType Srf1, SurfaceType Srf2 )
  2379. @\end{verbatim}
  2380.  Computes the symbolic product of the given two curves or surfaces as
  2381.  a curve or surface. The product is computed coordinate-wise.
  2382.  Example:
  2383. @\begin{verbatim}
  2384.  ProdSrf = SYMBPROD( Srf1, Srf2 )
  2385. @\end{verbatim}
  2386. @\subsubsection{SYMBDPROD}
  2387. !SYMBDPROD
  2388. @\begin{verbatim}
  2389.  CurveType SYMBDPROD( CurveType Crv1, CurveType Crv2 )
  2390.  SurfaceType SYMBDPROD( SurfaceType Srf1, SurfaceType Srf2 )
  2391. @\end{verbatim}
  2392.  Computes the symbolic dot (inner) product of the given two curves or surfaces
  2393.  as a {\em scalar} curve or surface.
  2394.  Example:
  2395. @\begin{verbatim}
  2396.  DiffCrv = symbdiff( Crv1, Crv2 )
  2397.  DistSqrCrv = SYMBDPROD( DiffCrv, DiffCrv )
  2398. @\end{verbatim}
  2399.  Computes a scalar curve that at parameter $t$ is equal to the distance
  2400.  square between Crv1 at $t$ and Crv2.
  2401. @\subsubsection{SYMBCPROD}
  2402. !SYMBCPROD
  2403. @\begin{verbatim}
  2404.  CurveType SYMBCPROD( CurveType Crv1, CurveType Crv2 )
  2405.  SurfaceType SYMBCPROD( SurfaceType Srf1, SurfaceType Srf2 )
  2406. @\end{verbatim}
  2407.  Computes the symbolic cross product of the given two curves or surfaces as
  2408.  a curve or surface.
  2409.  Example:
  2410. @\begin{verbatim}
  2411.  NrmlSrf = SYMBCPROD( sderive( Srf, ROW ), sderive( Srf, COL ) )
  2412. @\end{verbatim}
  2413.  computes a normal surface as the cross product of the surface two partial
  2414.  derivatives (see SNRMLSRF).
  2415. @\subsubsection{SYMBSUM}
  2416. !SYMBSUM
  2417. @\begin{verbatim}
  2418.  CurveType SYMBSUM( CurveType Crv1, CurveType Crv2 )
  2419.  SurfaceType SYMBSUM( SurfaceType Srf1, SurfaceType Srf2 )
  2420. @\end{verbatim}
  2421.  Computes the symbolic sum of the given two curves or surfaces as
  2422.  a curve or surface. The sum is computed coordinate-wise.
  2423.  Example:
  2424. @\begin{verbatim}
  2425.  SumCrv = SYMBSUM( Crv1, Crv2 )
  2426. @\end{verbatim}
  2427. @\subsubsection{SYMBDIFF}
  2428. !SYMBDIFF
  2429. @\begin{verbatim}
  2430.  CurveType SYMBDIFF( CurveType Crv1, CurveType Crv2 )
  2431.  SurfaceType SYMBDIFF( SurfaceType Srf1, SurfaceType Srf2 )
  2432. @\end{verbatim}
  2433.  Computes the symbolic difference of the given two curves or surfaces as
  2434.  a curve or surface. The difference is computed coordinate-wise.
  2435.  Example:
  2436. @\begin{verbatim}
  2437.  DiffCrv = SYMBDIFF( Crv1, Crv2 )
  2438.  DistSqrCrv = symbdprod( DiffCrv, DiffCrv )
  2439. @\end{verbatim}
  2440. @\subsubsection{TORUS}
  2441. !TORUS
  2442. @\begin{verbatim}
  2443.  PolygonType TORUS( VectorType Center, VectorType Normal,
  2444.                     NumericType MRadius, NumericType mRadius )
  2445. @\end{verbatim}
  2446.    Creates a TORUS geometric object, defined by {\bf Center} as the center
  2447.  of the TORUS, {\bf Normal} as the normal to the main plane of the TORUS,
  2448.  {\bf MRadius} and {\bf mRadius} as the major and minor radii of the TORUS.
  2449.    See RESOLUTION for the accuracy of the TORUS approximation as a polygonal
  2450.  model. 
  2451.  Example:
  2452. @\begin{verbatim}
  2453.     T = TORUS( vector( 0.0, 0.0, 0.0), vector( 0.0, 0.0, 1.0), 0.5, 0.2 );
  2454. @\end{verbatim}
  2455.  constructs a torus with major plane as the $XY$ plane, major radius of 0.5,
  2456.  and minor radius of 0.2.
  2457. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2458. @\subsection{Object transformation functions}
  2459. &Object transformation functions
  2460.  All the routines in this section construct a 4 by 4 homogeneous
  2461.  transformation matrix representing the required transform. These matrices
  2462.  may be concatenated to achieve more complex transforms using the matrix
  2463.  multiplication operator $*$. For example, the expression
  2464. @\begin{verbatim}
  2465.     m = trans( vector( -1, 0, 0 ) ) * rotx( 45 ) * trans( vector( 1, 0, 0 ) );
  2466. @\end{verbatim}
  2467.  constructs a transform to rotate an object around the X = 1 line, 45 degrees.
  2468.  A matrix representing the inverse transformation can be computed as:
  2469. @\begin{verbatim}
  2470.     InvM = m ^ -1
  2471. @\end{verbatim}
  2472.  See also overloading of the - operator.
  2473. @\subsubsection{HOMOMAT}
  2474. !HOMOMAT
  2475. @\begin{verbatim}
  2476.  MatrixType HOMOMAT( ListType MatData )
  2477. @\end{verbatim}
  2478.    Creates an arbitrary homogeneous transformation matrix by manually providing
  2479.  its 16 coefficients.
  2480.  Example:
  2481. @\begin{verbatim}
  2482.  for ( a = 1, 1, 720 / step,
  2483.        view_mat = save_mat *
  2484.                   HOMOMAT( list( list( 1, 0, 0, 0 ),
  2485.                                  list( 0, 1, 0, 0 ),
  2486.                                  list( 0, 0, 1, -a * step / 500 ),
  2487.                                  list( 0, 0, 0, 1 ) ) ):
  2488.        view(list(view_mat, b, axes), on)
  2489. @\end{verbatim}
  2490.  looping and viewing through a sequence of perspective transforms, created
  2491.  using the HOMOMAT constructor.
  2492. @\subsubsection{ROTX}
  2493. !ROTX
  2494. @\begin{verbatim}
  2495.  MatrixType ROTX( NumericType Angle )
  2496. @\end{verbatim}
  2497.    Creates a rotation around the X transformation matrix with {\bf Angle} degrees.
  2498. @\subsubsection{ROTY}
  2499. !ROTY
  2500. @\begin{verbatim}
  2501.  MatrixType ROTY( NumericType Angle )
  2502. @\end{verbatim}
  2503.    Creates a rotation around te Y transformation matrix with {\bf Angle} degrees.
  2504. @\subsubsection{ROTZ}
  2505. !ROTZ
  2506. @\begin{verbatim}
  2507.  MatrixType ROTZ( NumericType Angle )
  2508. @\end{verbatim}
  2509.    Creates a rotation around the Z transformation matrix with {\bf Angle} degrees.
  2510. @\subsubsection{SCALE}
  2511. !SCALE
  2512. @\begin{verbatim}
  2513.  MatrixType SCALE( VectorType ScaleFactors )
  2514. @\end{verbatim}
  2515.    Creates a scaling by the {\bf ScaleFactors} transformation matrix.
  2516. @\subsubsection{TRANS}
  2517. !TRANS
  2518. @\begin{verbatim}
  2519.  MatrixType TRANS( VectorType TransFactors )
  2520. @\end{verbatim}
  2521.    Creates a translation by the {\bf TransFactors} transformation matrix.
  2522. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2523. @\subsection{General purpose functions}
  2524. &General purpose functions  
  2525. @\subsubsection{ATTRIB}
  2526. !ATTRIB
  2527. @\begin{verbatim}
  2528.  ATTRIB( AnyType Object, StringType Name, StringType Value )
  2529.  ATTRIB( AnyType Object, StringType Name, RealType Value )
  2530. @\end{verbatim}
  2531.    Provides a mechanism to add a string or numeric attribute to an {\bf Object},
  2532.  with name {\bf Name} and value {\bf Value}.
  2533.    These attributes may be used to pass information to other programs about
  2534.  this object, and are saved with the objects in data files. For example,
  2535. @\begin{verbatim}
  2536.     ATTRIB(Glass, "rgb", "255,0,0");
  2537.     ATTRIB(Glass, "reflect", 1.4);
  2538. @\end{verbatim}
  2539.  sets the RGB color of the {\bf Glass} object.
  2540.    Attribute names are case insensitive. Spaces are allowed in the {\bf Value}
  2541.  string, as well as the double quote itself, although the latter must be
  2542.  escaped:
  2543. @\begin{verbatim}
  2544.     ATTRIB(Glass, "text", "Say \"this is me\"");
  2545. @\end{verbatim}
  2546. @\subsubsection{COLOR}
  2547. !COLOR
  2548. @\begin{verbatim}
  2549.  COLOR( GeometricType Object, NumericType Color )
  2550. @\end{verbatim}
  2551.    Sets the color of the object to one of those specified below. Note that an
  2552.  object has a default color (see IRIT.CFG file) according to its origin -
  2553.  loaded with the LOAD command, PRIMITIVE, or BOOLEAN operation result.
  2554.    The system internally supports colors (although you may have a B\&W system)
  2555.  and the colors recognized are:
  2556.  {\bf BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, YELLOW, and WHITE}.
  2557.    See the ATTRIB command for more fine control of colors using the RGB
  2558.  attribute. 
  2559. @\subsubsection{COMMENT}
  2560. !COMMENT
  2561. @\begin{verbatim}
  2562.  COMMENT
  2563. @\end{verbatim}
  2564.  Two types of comments are allowed:
  2565.  1. One-line comment: starts anywhere in a line at the '\#' character, up to
  2566.     the end of the line.
  2567.  2. Block comment: starts at the COMMENT keyword followed by a unique
  2568.     character (anything but white space), up to the second occurrence of that
  2569.     character. This is a fast way to comment out large blocks.
  2570.  Example:
  2571. @\begin{verbatim}
  2572.     COMMENT $
  2573.       This is a comment
  2574.     $
  2575. @\end{verbatim}
  2576. @\subsubsection{EXIT}
  2577. !EXIT
  2578. @\begin{verbatim}
  2579.  EXIT();
  2580. @\end{verbatim}
  2581.    Exits from the solid modeler. NO warning is given!
  2582. @\subsubsection{FOR}
  2583. @\begin{verbatim}
  2584.  FOR( NumericType Start, NumericType Increment, NumericType End, AnyType Body )
  2585. @\end{verbatim}
  2586.    Executes the {\bf Body} (see below), while the FOR loop conditions hold.
  2587.    {\bf Start, Increment, End} are evaluated first, and the loop is executed
  2588.  while {\bf $<=$ End} if {\bf Increment $>$ 0}, or while {\bf $>=$ End} if {\bf Increment $<$ 0}.
  2589.    If {\bf Start} is of the form "Variable = Expression", then that variable is
  2590.  updated on each iteration, and can be used within the body.
  2591.    The body may consist of any number of regular commands, separated by
  2592.  COLONs, including nesting FOR loops to an arbitrary level.
  2593.  Example:
  2594. @\begin{verbatim}
  2595.  step = 10;
  2596.  rotstepx = rotx(step);
  2597.  FOR ( a = 1, 1, 360 / step,
  2598.      view_mat = rotstepx * view_mat:
  2599.      view( list( view_mat, b, axes ), ON )
  2600. @\end{verbatim}
  2601.  Displays b and axes with a view direction that is rotated 10 degrees at a
  2602.  time around the X axis.
  2603. @\subsubsection{HELP}
  2604. !HELP
  2605. @\begin{verbatim}
  2606.  HELP( StringType Subject )
  2607. @\end{verbatim}
  2608.    Provides help on the specified Subject.
  2609.  Example:
  2610. @\begin{verbatim}
  2611.     HELP("");
  2612. @\end{verbatim}
  2613.  will list all {\em IRIT} help subjects.
  2614. @\subsubsection{FREE}
  2615. !FREE
  2616. @\begin{verbatim}
  2617.  FREE( GeometricType Object )
  2618. @\end{verbatim}
  2619.    Because of the usually huge size of geometric objects, this procedure
  2620.  may be used to free them. Reassigning a value (even of different type)
  2621.  to a variable automatically releases the old variable's allocated space
  2622.  as well.
  2623. @\subsubsection{FUNCTION}
  2624. !FUNCTION
  2625. @\begin{verbatim}
  2626.  FuncName = FUNCTION(Prm1, Prm2, ... , PrmN):LclVal1:LclVar2: ... :LclVarM:
  2627.      FuncBody;
  2628. @\end{verbatim}
  2629.  Defines a function named FuncName with N parameters and M local variables
  2630.  (N, M >= 0). Here is a (simple) example of a function with no local variables
  2631.  and a single parameter that computes the square of a number:
  2632. @\begin{verbatim}
  2633.  sqr = FUNCTION(x):
  2634.     return = x * x;
  2635. @\end{verbatim}
  2636.    Functions can be defined with optional parameters and optional local
  2637.  variables. A function's body may contain an arbitrary set of expressions
  2638.  including for loops, (user) function calls, or even recursive function calls,
  2639.  all separated by colons.
  2640.    The returned value of the function is the value of an automatically defined
  2641.  local variable named return. The return variable is a regular local variable
  2642.  within the scope of the function and can be used as any other variable.
  2643.    If a variable's name is found in neither the local variable list nor
  2644.  the parameter list, it is searched in the global variable list (outside
  2645.  the scope of the function). Binding of names of variables is static as in the
  2646.  C programming language.
  2647.    Because binding of variables is performed in execution time, there is a
  2648.  somewhat less restrictive type checking of parameters of functions that are
  2649.  invoked within a user's defined function.
  2650.    A function can invoke itself, i.e., it can be recursive. However, since a
  2651.  function should be defined when it is called, a dummy function should be
  2652.  defined before the recursive one is defined:
  2653. @\begin{verbatim}
  2654.  factorial = function(x):return = x; # Dummy function.
  2655.  factorial = function(x):
  2656.      if (x <= 1, return = 1, return = x * factorial(x - 1));
  2657. @\end{verbatim}
  2658.    Overloading is valid inside a function as it is outside. For example, for
  2659. @\begin{verbatim}
  2660.  add = FUNCTION(x, y):
  2661.     return = x + y;
  2662. @\end{verbatim}
  2663.  the following function calls are all valid:
  2664. @\begin{verbatim}
  2665.  add(1, 2);
  2666.  add(vector(1,2,3), point(1,2,3));
  2667.  add(box(vector(-3, -2, -1), 6, 4, 2), box(vector(-4, -3, -2), 2, 2, 4));
  2668. @\end{verbatim}
  2669.  Finally, here is a more interesting example that computes an approximation
  2670.  of the length of a curve, using the sqr function defined above:
  2671. @\begin{verbatim}
  2672.  distptpt = FUNCTION(pt1, pt2):
  2673.      return = sqrt(sqr(coord(pt1, 1) - coord(pt2, 1)) +
  2674.                    sqr(coord(pt1, 2) - coord(pt2, 2)) +
  2675.                    sqr(coord(pt1, 3) - coord(pt2, 3)));
  2676.  crvlength = FUNCTION(crv, n):pd:t:t1:t2:dt:pt1:pt2:i:
  2677.      return = 0.0:
  2678.      pd = pdomain(crv):
  2679.      t1 = nth(pd, 1):
  2680.      t2 = nth(pd, 2):
  2681.      dt = (t2 - t1) / n:
  2682.      pt1 = coerce(ceval(crv, t1), e3):
  2683.      for (i = 1, 1, n,
  2684.           pt2 = coerce(ceval(crv, t1 + dt * i), e3):
  2685.           return = return + distptpt(pt1, pt2):
  2686.           pt1 = pt2);
  2687. @\end{verbatim}
  2688.  Try, for example:
  2689. @\begin{verbatim}
  2690.  crvlength(circle(vector(0.0, 0.0, 0.0), 1.0), 30) / 2;
  2691.  crvlength(circle(vector(0.0, 0.0, 0.0), 1.0), 100) / 2;
  2692.  crvlength(circle(vector(0.0, 0.0, 0.0), 1.0), 300) / 2;
  2693. @\end{verbatim}
  2694.  See PROCEDURE for more.
  2695. @\subsubsection{IF}
  2696. @\begin{verbatim}
  2697.  IF( NumericType Cond, AnyType TrueBody { , AnyType FalseBody } )
  2698. @\end{verbatim}
  2699.    Executes {\bf TrueBody} (group of regular commands, separated by COLONs -
  2700.  see FOR loop) if the {\bf Cond} holds, i.e., it is a numeric value other than
  2701.  zero, or optionally, if it exists, executes {\bf FalseBody} if the {\bf Cond}
  2702.  does not hold, i.e., it evaluates to a numeric value equal to zero.
  2703.  Examples:
  2704. @\begin{verbatim}
  2705.     IF ( machine == IBMOS2, resolution = 5, resolution = 10 );
  2706.     IF ( a > b, max = a, max = b );
  2707. @\end{verbatim}
  2708.  sets the resolution to be 10, unless running on an IBMOS2 system, in which
  2709.  case the resolution variable will be set to 5 in the first statement, and
  2710.  set max to the maximum of a and b in the second statement.
  2711. @\subsubsection{INCLUDE}
  2712. !INCLUDE
  2713. @\begin{verbatim}
  2714.  INCLUDE( StringType FileName )
  2715. @\end{verbatim}
  2716.    Executes the script file {\bf FileName}. Nesting of include file is allowed up
  2717.  to 10 levels deep. If an error occurs, all open files in all nested files
  2718.  are closed and data are waited for at the top level (standard input).
  2719.    A script file can contain any command the solid modeler supports.
  2720.  Example:
  2721. @\begin{verbatim}
  2722.     INCLUDE( "general.irt" );
  2723. @\end{verbatim}
  2724.  includes the file "general.irt".
  2725. @\subsubsection{INTERACT}
  2726. !INTERACT
  2727. @\begin{verbatim}
  2728.  INTERACT( GeometryTreeType Object )
  2729. @\end{verbatim}
  2730.    A user-defined function (see iritinit.irt) that does the following,
  2731.  in order:
  2732. @\begin{enumerate}
  2733. @\item
  2734.  Clear the display device.
  2735. @\item
  2736.  Display the given {\bf Object}.
  2737. @\item
  2738.  Pause for a keystroke.
  2739. @\end{enumerate}
  2740.    This user-defined function in version 4.0 of {\em IRIT} is an
  2741.  emulation of the INTERACT function that used to exist in previous versions.
  2742.  Example:
  2743. @\begin{verbatim}
  2744.  INTERACT( list( view_mat, Axes, Obj ) );
  2745. @\end{verbatim}
  2746.  displays and interacts with the object {\bf Obj} and the predefined object
  2747.  {\bf Axes}. VIEW\_MAT will be used to set the starting transformation.
  2748.    See VIEW and VIEWOBJ for more.
  2749. @\subsubsection{LIST}
  2750. !LIST
  2751. @\begin{verbatim}
  2752.  ListType LIST( AnyType Elem1, AnyType Elem2, ... )
  2753. @\end{verbatim}
  2754.    Constructs an object as a list of several other objects. Only a reference
  2755.  is made to the Elements, so modifying Elem1 after being included in the list
  2756.  will affect Elem1 in that list next time list is used!
  2757.    Each inclusion of an object in a list increases its internal {\bf used}
  2758.  reference. The object is freed iff in {\bf used} reference is zero.
  2759.    As a result, attempt to delete a variable (using FREE) which is referenced
  2760.  in a list removes the variable, but the object itself is freed only when the
  2761.  list is freed.
  2762. @\subsubsection{LOAD}
  2763. !LOAD
  2764. @\begin{verbatim}
  2765.  AnyType LOAD( StringType FileName )
  2766. @\end{verbatim}
  2767.    Loads an object from the given {\bf FileName}. The object may be any object
  2768.  defined in the system, including lists, in which the structure is recovered
  2769.  and reconstructed as well (internal objects are inserted into the global
  2770.  system object list if they have names). If no file type is provided, ".dat"
  2771.  is assumed.
  2772.    Under unix, compressed files can be loaded if the given file name has
  2773.  a postfix of ".Z". The unix system's "zcat" will be invoked via a pipe
  2774.  for that purpose.
  2775. @\subsubsection{LOGFILE}
  2776. !LOGFILE
  2777. @\begin{verbatim}
  2778.  LOGFILE( NumericType Set )
  2779. @\end{verbatim}
  2780.    If {\bf Set} is non zero (see TRUE/FALSE and ON/OFF), then everything
  2781.  printed in the input window, will go to the log file specified in the
  2782.  IRIT.CFG configuration file. This file will be created the first time
  2783.  logfile is turned ON.
  2784. @\subsubsection{NTH}
  2785. @\begin{verbatim}
  2786.  AnyType NTH( ListType ListObject, NumericType Index )
  2787. @\end{verbatim}
  2788.  Returns the {\bf Index} (base count 1) element of the list {\bf ListObject}.
  2789.  Example:
  2790. @\begin{verbatim}
  2791.     Lst = list( a, list( b, c ), d );
  2792.     Lst2 = NTH( Lst, 2 );
  2793. @\end{verbatim}
  2794.  and now {\bf Lst2} is equal to 'list( b, c )'.
  2795. @\subsubsection{PAUSE}
  2796. !PAUSE
  2797. @\begin{verbatim}
  2798.  PAUSE( NumericType Flush )
  2799. @\end{verbatim}
  2800.    Waits for a keystroke. Nice to have if a temporary stop in a middle of an
  2801.  included file (see INCLUDE) is required. If {\bf Flush} is TRUE, then the input
  2802.  is first flushed to guarantee that the actual stop will occur.
  2803. @\subsubsection{PRINTF}
  2804. !PRINTF
  2805. @\begin{verbatim}
  2806.  PRINTF( StringType CtrlStr, ListType Data )
  2807. @\end{verbatim}
  2808.  A formatted printing routine, following the concepts of the C programming
  2809.  language's {\em printf} routine. {\bf CtrlStr} is a string object for which
  2810.  the following special '\%' commands are supported:
  2811. #15 2 0 1
  2812.  \%d, \%i, %u
  2813.   Prints the numeric object as an integer or unsigned integer.
  2814.  \%o, \%x, \%X
  2815.   Prints the numeric object as an octal or hexadecimal integer.
  2816.  \%e, \%f, \%g,
  2817.   Prints the numeric object in several formats of
  2818.  \%E, \%F
  2819.   floating point numbers.
  2820.   Prints the string object as a string.
  2821.  \%pe, \%pf, \%pg
  2822.   Prints the three coordinates of the point object.
  2823.  \%ve, \%vf, \%vg
  2824.   Prints the three coordinates of the vector object.
  2825.  \%Pe, \%Pf, \%Pg,
  2826.   Prints the four coordinates of the plane object.
  2827.  \%De, \%Df, \%Dg,
  2828.   Prints the given object in IRIT's data file format.
  2829.  All the '\%' commands can include any modifier that is valid in the C
  2830.  programming language printf routine, including l (long), prefix
  2831.  character(s), size, etc. The point, vector, plane, and object commands
  2832.  can also be modified in a similar way, to set the format of the
  2833.  numeric data printed.
  2834.  Also supported are the newline and tab using the backslash escape
  2835.  character:
  2836. @\begin{verbatim}
  2837. * PRINTF("\\tThis is the char \"\\%\"\\n", nil());
  2838. @\end{verbatim}
  2839.  Backslashes should be escaped themselves as can be seen in the above example.
  2840.  Here are few more examples:
  2841. @\begin{verbatim}
  2842. * PRINTF("this is a string \"%s\" and this is an integer %8d.\\n",
  2843. *       list("STRING", 1987));
  2844. * PRINTF("this is a vector [%8.5lvf]\\n", list(vector(1,2,3)));
  2845. * dumplvl = 9;
  2846. * PRINTF("this is a object %8.6lDf...\\n", list(axes));
  2847. * PRINTF("this is a object %10.8lDg...\\n", list(axes));
  2848. @\end{verbatim}
  2849.  This implementation of PRINTF is somewhat different than the C programming
  2850.  language's version, because the backslash {\em always} escapes the next
  2851.  character during the processing stage of IRIT's parser. That is, the string
  2852. @\begin{verbatim}
  2853. *        '\\tThis is the char \"\\%\"\\n'
  2854. @\end{verbatim}
  2855.  is actually parsed by the IRIT's parser into
  2856. @\begin{verbatim}
  2857. *        '\tThis is the char "\%"\n'
  2858. @\end{verbatim}
  2859.  because this is the way the IRIT parser processes strings. The latter
  2860.  string is the one that PRINTF actually see.
  2861. @\subsubsection{PROCEDURE}
  2862. !PROCEDURE
  2863. @\begin{verbatim}
  2864.  ProcName = PROCEDURE(Prm1, Prm2, ... , PrmN):LclVal1:LclVar2: ... :LclVarM:
  2865.      ProcBody;
  2866. @\end{verbatim}
  2867.  A procedure is a function that does not return a value, and therefore the
  2868.  return variable (see FUNCTION) should not be used. A procedure is
  2869.  identical to a function in every other way. See FUNCTION for more.
  2870. @\subsubsection{SAVE}
  2871. !SAVE
  2872. @\begin{verbatim}
  2873.  SAVE( StringType FileName, AnyType Object )
  2874. @\end{verbatim}
  2875.    Saves the provided {\bf Object} in the specified file name {\bf FileName}.
  2876.  No extension type is needed (ignored if specified), and ".dat" is always
  2877.  used. {\bf Object} can be any object type, including list, in which structure
  2878.  is saved recursively. See also LOAD. If a display device is actively running
  2879.  at the time SAVE is invoked, its transformation matrix will be saved with the
  2880.  same name but with extension type of ".mat" instead of ".dat".
  2881.    Under unix, files will be saved compressed if the given file name has
  2882.  a postfix of ".Z". The unix system's "compress" will be invoked via a pipe
  2883.  for that purpose.
  2884. @\subsubsection{SNOC}
  2885. !SNOC
  2886. @\begin{verbatim}
  2887.  SNOC( AnyType Object, ListType ListObject )
  2888. @\end{verbatim}
  2889.    Similar to the lisp cons operator but puts the new {\bf Object} in the
  2890.  {\em end} of the list {\bf ListObject} instead of the beginning, in place.
  2891.  Example:
  2892. @\begin{verbatim}
  2893.     Lst = list( axes );
  2894.     SNOC( Srf, Lst );
  2895. @\end{verbatim}
  2896.  and now {\bf Lst} is equal to the list 'list( axes, Srf )'.
  2897. @\subsubsection{SYSTEM}
  2898. !SYSTEM
  2899. @\begin{verbatim}
  2900.  SYSTEM( StringType Command )
  2901. @\end{verbatim}
  2902.    Executes a system command {\bf Command}. For example,
  2903. @\begin{verbatim}
  2904.     SYSTEM( "ls -l" );
  2905. @\end{verbatim}
  2906. @\subsubsection{TIME}
  2907. !TIME
  2908. @\begin{verbatim}
  2909.  TIME( NumericType Reset )
  2910. @\end{verbatim}
  2911.    Returns the time in seconds from the last time TIME was called with
  2912.  {\bf Reset} TRUE. This time is CPU time if such support is available
  2913.  from the system (times function), and is real time otherwise (time
  2914.  function).
  2915.    The time is automatically reset at the beginning of the execution of this
  2916.  program.
  2917.  Example:
  2918. @\begin{verbatim}
  2919.     Dummy = TIME( TRUE );
  2920.       .
  2921.       .
  2922.       .
  2923.     TIME( FALSE );
  2924. @\end{verbatim}
  2925.  prints the time in seconds between the above two time function calls.
  2926. @\subsubsection{VARLIST}
  2927. !VARLIST
  2928. @\begin{verbatim}
  2929.  VARLIST()
  2930. @\end{verbatim}
  2931.    List all the currently defined objects in the system.
  2932. @\subsubsection{VECTOR}
  2933. !VECTOR
  2934. @\begin{verbatim}
  2935.  VectorType VECTOR( NumericType X, NumericType Y, NumericType Z )
  2936. @\end{verbatim}
  2937.    Creates a vector type object, using the three provided NumericType scalars.
  2938. @\subsubsection{VIEW}
  2939. !VIEW
  2940. @\begin{verbatim}
  2941.  VIEW( GeometricTreeType Object, NumericType ClearWindow )
  2942. @\end{verbatim}
  2943.    Displays the (geometric) object(s) as given in {\bf Object}.
  2944.    If {\bf ClearWindow} is non-zero (see TRUE/FALSE and ON/OFF) the window is
  2945.  first cleared (before drawing the objects).
  2946.  Example:
  2947. @\begin{verbatim}
  2948.     VIEW( Axes, FALSE );
  2949. @\end{verbatim}
  2950.  displays the predefined object {\bf Axes} in the viewing window on top of
  2951.  what is drawn already.
  2952.  In version 4.0, this function is emulated (see iritinit.irt) using the
  2953.  VIEWOBJ function. In order to use the current viewing matrix, VIEW\_MAT
  2954.  should be provided as an additional parameter. For example,
  2955. @\begin{verbatim}
  2956.     VIEW( list( view_mat, Obj ), TRUE );
  2957. @\end{verbatim}
  2958.  However, since VIEW is a user defined function, the following will not
  2959.  use VIEW\_MAT as one would expect:
  2960. @\begin{verbatim}
  2961.     VIEW( view_mat, TRUE );
  2962. @\end{verbatim}
  2963.  because VIEW\_MAT will be renamed inside the VIEW user defined function to
  2964.  a local (to the user defined function) variable.
  2965.  In iritinit.irt one can find several other useful VIEW related functions:
  2966. # 15 2 0 1
  2967.  VIEWCLEAR
  2968.   Clears all data displayed on the display device.
  2969.  VIEWREMOVE
  2970.   Removes the object specified by name from display.
  2971.  VIEWDISC
  2972.   Disconnects from display device (which is still running)
  2973.   while allowing IRIT to connect to a new device.
  2974.  VIEWEXIT
  2975.   Forces the display device to exit.
  2976.  VIEWSAVE
  2977.   Request sdisplay device to save transformation matrix.
  2978.  BEEP
  2979.   An emulation of the BEEP command of versions prior to 4.0.
  2980.  VIEWSTATE
  2981.   Allows to change the state of the display device.
  2982.    For the above VIEW related functions, only VIEWREMOVE, VIEWSAVE, and
  2983.  VIEWSTATE require a parameter, which is the file name and view state
  2984.  respectively. The view state can be one of several commands. See the
  2985.  display device section for more.
  2986.  Examples:
  2987. @\begin{verbatim}
  2988.     VIEWCLEAR();
  2989.     VIEW( axes, off );
  2990.     VIEWSTATE( "LngrVecs" );
  2991.     VIEWSTATE( "DrawSolid" );
  2992.     VIEWSAVE( "matrix1" );
  2993.     VIEWREMOVE( "axes" );
  2994.     VIEWDISC();
  2995. @\end{verbatim}
  2996. @\subsubsection{VIEWOBJ}
  2997. !VIEWOBJ
  2998. @\begin{verbatim}
  2999.  VIEWOBJ( GeometricTreeType Object )
  3000. @\end{verbatim}
  3001.    Displays the (geometric) object(s) as given in {\bf Object}.
  3002.  {\bf Object} may be any GeometricType or a list of other
  3003.  GeometricTypes nested to an arbitrary level.
  3004.    Unlike {\em IRIT} versions prior to 4.0, VIEW\_MAT is not explicitly used
  3005.  as the transformation matrix. In order to display with a VIEW\_MAT view,
  3006.  VIEW\_MAT should be listed as an argument (in that exact name) to
  3007.  VIEWOBJ. Same is true for the perspective matrix PRSP\_MAT.
  3008.  Example:
  3009. @\begin{verbatim}
  3010.     VIEWOBJ( list( view_mat, Axes ), FALSE );
  3011. @\end{verbatim}
  3012.  displays the predefined object {\bf Axes} in the viewing window using the
  3013.  viewing matrix VIEW\_MAT.
  3014. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3015. @\subsection{System variables}
  3016. &System variables
  3017.  System variables are predefined objects in the system. Any time {\em IRIT} is
  3018.  executed, these variable are automatically defined and set to values which
  3019.  are sometimes machine dependent. These are {\em regular} objects in any other
  3020.  sense, including the ability to delete or overwrite them. One can modify,
  3021.  delete, or introduce other objects using the IRITINIT.IRT file.
  3022. @\subsubsection{AXES}
  3023. !AXES
  3024.    Predefined polyline object (PolylineType) that describes the $XYZ$ axes.
  3025. @\subsubsection{COPLANAR}
  3026. !COPLANAR
  3027.    Predefined Boolean object (NumericType). If TRUE the polygonal Boolean
  3028.  operations will support coplanar faces but is somewhat slower.
  3029.  Default is FALSE.
  3030. @\subsubsection{DRAWCTLPT}
  3031. !DRAWCTLPT
  3032.    Predefined Boolean variable (NumericType) that controls whether curves'
  3033.  control polygons and surfaces' control meshes are drawn (TRUE) or not
  3034.  (FALSE). Default is FALSE.
  3035. @\subsubsection{DUMPLVL}
  3036. !DUMPLVL
  3037.    Content of objects assigned to variables can be displayed by executing the
  3038.  command 'ObjName;' where ObjName is the name of the object. This variable
  3039.  (NumericType) controls the way the data are dumped as follows:
  3040. # 20 2 1 1
  3041.  DumpLvl $>=$ 0
  3042.   Only object names/types are printed.
  3043.  DumpLvl $>=$ 1
  3044.   Non-geometric object values are dumped.
  3045.  DumpLvl $>=$ 2
  3046.   Curves and Surfaces are dumped.
  3047.  DumpLvl $>=$ 3
  3048.   Polygons/lines are dumped.
  3049.  DumpLvl $>=$ 4
  3050.   List objects are traversed recursively.
  3051.  Default value is 1.
  3052. @\subsubsection{ECHOSRC}
  3053. !ECHOSRC
  3054.    Predefined Boolean variable (NumericType) controlling echoing of
  3055.  interpreted commands to screen (TRUE) or not (FALSE). Default value is TRUE.
  3056. @\subsubsection{FLAT4PLY}
  3057. !FLAT4PLY
  3058.    Predefined Boolean object (NumericType) that controls the way almost flat
  3059.  surface patches are converted to polygons: four polygons (TRUE) or only
  3060.  two polygons (FALSE). Default value is FALSE.
  3061. @\subsubsection{INTERCRV}
  3062. !INTERCRV
  3063.    Predefined numeric object (NumericType) that if TRUE the Boolean geometry
  3064.  operators return the intersection curves instead of the result model.
  3065.  Default value is FALSE.
  3066. @\subsubsection{MACHINE}
  3067. !MACHINE
  3068.    Predefined numeric object (NumericType) holding the machine type as one of
  3069.  the following constants: MSDOS, SGI, HP, SUN, APOLLO, UNIX, IBMOS2, IBMNT,
  3070.  and AMIGA.
  3071. @\subsubsection{POLYSORT}
  3072. !POLYSORT
  3073.    Predefined numeric object (NumericType) that determines the directional
  3074.  axis along which the polygons are sorted during Boolean operations. Default is
  3075.  the $x$ axis or 0. Set to 1 for $y$ sorting. or to $2$ for $z$ sorting.
  3076. @\subsubsection{PRSP\_MAT}
  3077. !PRSP_MAT
  3078.    Predefined matrix object (MatrixType) to hold the perspective matrix
  3079.  used/set by VIEW and/or INTERACT commands. See also VIEW\_MAT.
  3080. @\subsubsection{RESOLUTION}
  3081. !RESOLUTION
  3082.    Predefined numeric object (NumericType) that sets the accuracy of the
  3083.  polygonal primitive geometric objects and the approximation of curves and
  3084.  surfaces. Holds the number of divisions a circle is divided into (with
  3085.  minimum value of 4). If, for example, RESOLUTION is set to 6, then a
  3086.  generated CONE will effectively be a six-sided pyramid.
  3087.    Also controls the fineness of freeform curves and surfaces when they are
  3088.  approximated as piecewise linear polylines, and the fineness of freeform
  3089.  surfaces when they are approximated as polygons.
  3090. @\subsubsection{VIEW\_MAT}
  3091. !VIEW_MAT
  3092.    Predefined matrix object (MatrixType) to hold the viewing matrix used/set
  3093.  by VIEW and/or INTERACT commands. See also PRSP\_MAT.
  3094. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3095. @\subsection{System constants}
  3096. &System constants
  3097.  The following constants are used by the various functions of the system to
  3098.  signal certain conditions. Internally, they are represented numerically,
  3099.  although, in general, their exact value is unimportant and may be changed
  3100.  in future versions. In the rare circumstance that  you need to know their
  3101.  values, simply type the constant as an expression.
  3102.  Example:
  3103. @\begin{verbatim}
  3104.     MAGENTA;
  3105. @\end{verbatim}
  3106. @\subsection{AMIGA}
  3107. !AMIGA
  3108.  A constant designating an AMIGA system, in the MACHINE variable.
  3109. @\subsubsection{APOLLO}
  3110. !APOLLO
  3111.  A constant designating an APOLLO system, in the MACHINE variable.
  3112. @\subsubsection{BLACK}
  3113. !BLACK
  3114.  A constant defining a BLACK color.
  3115. @\subsubsection{BLUE}
  3116. !BLUE
  3117.  A constant defining a BLUE color.
  3118. @\subsubsection{COL}
  3119.  A constant defining the COLumn direction of a surface mesh.
  3120. @\subsubsection{CTLPT\_TYPE}
  3121. !CTLPT_TYPE
  3122.  A constant defining an object of type control point.
  3123. @\subsubsection{CURVE\_TYPE}
  3124. !CURVE_TYPE
  3125.  A constant defining an object of type curve.
  3126. @\subsubsection{CYAN}
  3127. !CYAN
  3128.  A constant defining a CYAN color.
  3129. @\subsubsection{E1}
  3130.  A constant defining an E1 (X only coordinate) control point type.
  3131. @\subsubsection{E2}
  3132.  A constant defining an E2 (X and Y coordinates) control point type.
  3133. @\subsubsection{E3}
  3134.  A constant defining an E3 (X, Y and Z coordinates) control point type.
  3135. @\subsubsection{E4}
  3136.  A constant defining an E4 control point type.
  3137. @\subsubsection{E5}
  3138.  A constant defining an E5 control point type.
  3139. @\subsubsection{FALSE}
  3140. !FALSE
  3141.  A zero constant. May be used as Boolean operand.
  3142. @\subsubsection{GREEN}
  3143. !GREEN
  3144.  A constant defining a GREEN color.
  3145. @\subsubsection{HP}
  3146.  A constant designating an HP system, in the MACHINE variable.
  3147. @\subsubsection{IBMOS2}
  3148. !IBMOS
  3149.  A constant designating an IBM system running under OS2, in the MACHINE
  3150.  variable.
  3151. @\subsubsection{IBMNT}
  3152. !IBMNT
  3153.  A constant designating an IBM system running under Windows NT, in the MACHINE
  3154.  variable.
  3155. @\subsubsection{KV\_FLOAT}
  3156. !KV_FLOAT
  3157.  A constant defining a floating end condition uniformly spaced knot vector.
  3158. @\subsubsection{KV\_OPEN}
  3159. !KV_OPEN
  3160.  A constant defining an open end condition uniformly spaced knot vector.
  3161. @\subsubsection{MAGENTA}
  3162. !MAGENTA
  3163.  A constant defining a MAGENTA color.
  3164. @\subsubsection{MATRIX\_TYPE}
  3165. !MATRIX_TYPE
  3166.  A constant defining an object of type matrix.
  3167. @\subsubsection{MSDOS}
  3168. !MSDOS
  3169.  A constant designating an MSDOS system, in the MACHINE variable.
  3170. @\subsubsection{NUMERIC\_TYPE}
  3171. !NUMERIC_TYPE
  3172.  A constant defining an object of type numeric.
  3173. @\subsubsection{OFF}
  3174.  Synonym of FALSE.
  3175. @\subsubsection{ON}
  3176.  Synonym for TRUE.
  3177. @\subsubsection{P1}
  3178.  A constant defining a P1 (X and W coordinates) rational control point
  3179.  type.
  3180. @\subsubsection{P2}
  3181.  A constant defining a P2 (X, Y and W coordinates) rational control point
  3182.  type.
  3183. @\subsubsection{P3}
  3184.  A constant defining a P3 (X, Y, Z and W coordinates) rational control
  3185.  point type.
  3186. @\subsubsection{P4}
  3187.  A constant defining a P4 rational control
  3188.  point type.
  3189. @\subsubsection{P5}
  3190.  A constant defining a P5 rational control
  3191.  point type.
  3192. @\subsubsection{PI}
  3193.  The constant of 3.141592...
  3194. @\subsubsection{PLANE\_TYPE}
  3195. !PLANE_TYPE
  3196.  A constant defining an object of type plane.
  3197. @\subsubsection{POINT\_TYPE}
  3198. !POINT_TYPE
  3199.  A constant defining an object of type point.
  3200. @\subsubsection{POLY\_TYPE}
  3201. !POLY_TYPE
  3202.  A constant defining an object of type poly.
  3203. @\subsubsection{RED}
  3204.  A constant defining a RED color.
  3205. @\subsubsection{ROW}
  3206.   A constant defining the ROW direction of a surface mesh.
  3207. @\subsubsection{SGI}
  3208.  A constant designating an SGI system, in the MACHINE variable.
  3209. @\subsubsection{STRING\_TYPE}
  3210. !STRING_TYPE
  3211.  A constant defining an object of type string.
  3212. @\subsubsection{SURFACE\_TYPE}
  3213. !SURFACE_TYPE
  3214.  A constant defining an object of type surface.
  3215. @\subsubsection{SUN}
  3216.  A constant designating a SUN system, in the MACHINE variable.
  3217. @\subsubsection{TRUE}
  3218. !TRUE
  3219.  A non zero constant. May be used as Boolean operand.
  3220. @\subsubsection{UNIX}
  3221. !UNIX
  3222.  A constant designating a generic UNIX system, in the MACHINE variable.
  3223. @\subsubsection{VECTOR\_TYPE}
  3224. !VECTOR_TYPE
  3225.  A constant defining an object of type vector.
  3226. @\subsubsection{WHITE}
  3227. !WHITE
  3228.  A constant defining a WHITE color.
  3229. @\subsubsection{YELLOW}
  3230. !YELLOW
  3231.  A constant defining a YELLOW color.
  3232. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3233. @\section{Display devices}
  3234. !Display devices
  3235.  The following display device drivers are available,
  3236. # 16 3 0 1
  3237.  Device Name
  3238.   Invocation
  3239.    Environment
  3240.  xgldrvs
  3241.   xgldrvs -s-
  3242.    SGI 4D GL regular driver.
  3243.  xgladap
  3244.   xgladap -s-
  3245.    SGI 4D GL adaptive isocurve experminal driver.
  3246.  x11drvs
  3247.   xgldrvs -s-
  3248.    X11 driver.
  3249.  wntdrvs
  3250.   wntdrvs -s-
  3251.    IBM PC Windows NT driver.
  3252.  os2drvs
  3253.   os2drvs -s-
  3254.    IBM PC OS2 2.x driver.
  3255.  amidrvs
  3256.   amidrvs -s-
  3257.    AmigaDOS 2.04+ driver.
  3258.  nuldrvs
  3259.   nuldrvs -s- [-d] [-D]
  3260.    A device to print the object stream to stdout.
  3261.  All display devices are clients communicating with the server ({\em IRIT})
  3262.  using IPC (inter process communication). On Unix and Window NT sockets are
  3263.  used. A Windows NT client can talk to a server ({\em IRIT}) on a unix host if
  3264.  hooked to the same netwrok. On OS2 pipes are used, and both the client and
  3265.  server must run on the same machine. On AmigaDOS exec messages are used,
  3266.  and both the client and server must run on the same machine.
  3267.    The server ({\em IRIT}) will automatically start a client display device
  3268.  if the IRIT\_DISPLAY environment variable is set to the name and options of
  3269.  the display device to run. For example:
  3270. @\begin{verbatim}
  3271.     setenv IRIT_DISPLAY xgldrvs -s-
  3272. @\end{verbatim}
  3273.    The display device must be in a directory that is in the {\bf path}
  3274.  environment variable. Most display devices require the '-s-' flags to run
  3275.  in a non-standalone mode, or a client-server mode. Most drivers can also
  3276.  be used to display data in a standalone mode (i.e., no server). For
  3277.  example:
  3278. @\begin{verbatim}
  3279.     xgldrvs -s solid1.dat irit.mat
  3280. @\end{verbatim}
  3281.     Effectively, all the display devices are also data display programs
  3282.  (poly3d, which was the display program prior to version 4.0, is retired
  3283.  in 4.0). Therefore some functionality is not always as expected. For
  3284.  example, the quit button will always force the display device to quit,
  3285.  even if poped up from {\em IRIT}, but will not cause {\em IRIT} to
  3286.  quit as might logically expected. In fact, the next time {\em IRIT} will
  3287.  try to communicate with the display device, it will find the broken
  3288.  connection and will start up a new display device.
  3289.     All display devices recognize all the command line flags and all the
  3290.  configuration options in a configuration file, as described below. The display
  3291.  devices will make attemps to honor the requests, to the best of their ability.
  3292.     For example, only xgldrvs can render shaded models, and so only it will
  3293.  honor a {\bf DrawSolid} configuration options.
  3294. @\subsection{Command Line Options}
  3295. !Command Line Options
  3296. @\begin{verbatim}
  3297.  ???drvs [-s] [-u] [-n] [-N] [-i] [-c] [-m] [-I #IsoLines] [-S #SampPerCrv]
  3298.          [-f FineNess] [-l LineWidth] [-d] [-D] [-L NormalLen] [-4]
  3299.          [-b BackGround] [-M] [-P] [-z] DFiles 
  3300. @\end{verbatim}
  3301. @\begin{itemize}
  3302. @\item
  3303.   {\bf -s}: Runs the driver in a Standalone mode. Otherwise, the driver will
  3304.         attempt to communicate with the {\em IRIT} server.
  3305. @\item
  3306.   {\bf -u}: Forces a Unit matrix. That is, input data are {\em not}
  3307.         transformed at all.
  3308. @\item
  3309.   {\bf -n}: Draws normals of vertices.
  3310. @\item
  3311.   {\bf -N}: Draws normals of polygons.
  3312. @\item
  3313.   {\bf -i}: Draws internal edges (created by {\em IRIT}) - default is not to
  3314.         display them, and this option will force displaying them as well.
  3315. @\item
  3316.   {\bf -c}: Sets depth cueing on. Drawings that are closer to the viewer will
  3317.         be drawn in more intense color.
  3318. @\item
  3319.   {\bf -m}: Provides some more information on the data file(s) parsed.
  3320. @\item
  3321.   {\bf -I \#IsoLines}: Specifies number of isolines per surface, per direction.
  3322. @\item
  3323.   {\bf -S \#SampPerCrv}: Specifies the log based 2 of number of samples per
  3324.         (iso)curve.
  3325. @\item
  3326.   {\bf -f FineNess}: Controls the fineness of the surface to polygon subdivision.
  3327.         This number is log based 2 of roughly the number of subdivisions of
  3328.         the surface in each axis.
  3329. @\item
  3330.   {\bf -l LineWidth}: Sets the linewidth, in pixels. Default is one pixel wide.
  3331. @\item
  3332.   {\bf -d}: Debug objects. Prints to stderr all objects read from communcation
  3333.         port with the server {\em IRIT}. 
  3334. @\item
  3335.   {\bf -D}: Debug input. Prints to stderr all characters read from communcation
  3336.         port with the server {\em IRIT}. Lowest level of communication.
  3337. @\item
  3338.   {\bf -L NormalLen}: Sets the length of the drawn normals in thousandths of
  3339.         a unit.
  3340. @\item
  3341.   {\bf -4}: Forces four polygons per almost flat region in the surface to
  3342.         polygon conversion. Otherwise two polygons only.
  3343. @\item
  3344.   {\bf -b BackGround}: Sets the background color as three RGB integers in the
  3345.         range of 0 to 255.
  3346. @\item
  3347.   {\bf -M}: Draw control mesh/polygon of curves and surfaces, as well.
  3348. @\item
  3349.   {\bf -P}: Draws curves and surfaces (surfaces are drawn using a set of
  3350.         isocurves, see -I, or polygons, see -f).
  3351. @\item
  3352.   {\bf -z}: Prints version number and current defaults.
  3353. @\end{itemize}
  3354. @\subsection{Configuration Options}
  3355. !Configuration Options
  3356.  The configuration file is read {\em before} the command line options are
  3357.  processed. Therefore, all options in this section can be overriden
  3358.  by the appropriate command line option, if any.
  3359. @\begin{itemize}
  3360. @\item
  3361.   {\bf TransPrefPos:} Preferred location (Xmin, YMin, Xmax, Ymax) of the
  3362.         transformation window.
  3363. @\item
  3364.   {\bf ViewPrefPos:} Preferred location (Xmin, YMin, Xmax, Ymax) of the
  3365.         viewing window.
  3366. @\item
  3367.   {\bf BackGround:} Background color. Same as '-b'.
  3368. @\item
  3369.   {\bf Internal:} Draws internal edges. Same as '-i'.
  3370. @\item
  3371.   {\bf DrawVNormal:} Draws normals of vertices. Same as '-n'.
  3372. @\item
  3373.   {\bf DrawPNormal:} Draws normals of polygons. Same as '-n'.
  3374. @\item
  3375.   {\bf MoreVerbose:} Provides some more information on the data file(s)
  3376.         parsed. Same as '-m'.
  3377. @\item
  3378.   {\bf UnitMatrix:} Forces a Unit matrix. That is, input data are {\em not}
  3379.         transformed at all. Same as '-u'.
  3380. @\item
  3381.   {\bf DrawSolid:} Requests a shaded surface rendering, as opposed to isocurve
  3382.         surface representation.
  3383. @\item
  3384.   {\bf DoubleBuffer:} Requests drawing using a double buffer, if any.
  3385. @\item
  3386.   {\bf NumOfIsolines:}  Specifies number of isolines per surface, per
  3387.         direction. Same as '-I'.
  3388. @\item
  3389.   {\bf SamplesPerCurve:} Specifies the log based 2 of number of samples per
  3390.         (iso)curve. Same as '-S'.
  3391. @\item
  3392.   {\bf LineWidth:} Sets the linewidth, in pixels. Default is one pixel
  3393.        wide. Same as '-l'
  3394. @\item
  3395.   {\bf AdapIsoDir:} Selects the direction of the adaptive isoline
  3396.         rendering.
  3397. @\item
  3398.   {\bf FineNess:} Controls the fineness of the surface to polygon subdivision.
  3399.         This number is log based 2 of roughly the number of subdivisions of
  3400.         the surface in each axis. Same as '-f'.
  3401. @\item
  3402.   {\bf DepthCue:} Set depth cueing on. Drawings that are closer to the
  3403.         viewer will be drawn in more intense color. Same as '-c'.
  3404. @\item
  3405.   {\bf FourPerFlat:} Forces four polygons per almost flat region in the
  3406.         surface to polygon conversion. Otherwise two polygons only. Same as
  3407.         '-4'.
  3408. @\item
  3409.   {\bf AntiAlias:} Request the drawing of anti aliased lines.
  3410. @\item
  3411.   {\bf DrawSurfaceMesh:} Draws control mesh/polygon of curves and surfaces,
  3412.         as well. Same as '-M'.
  3413. @\item
  3414.   {\bf DrawSurfacePoly:} Draws curves and surfaces (surfaces are drawn using
  3415.         a set of isocurves, see -I, or polygons, see -f). Same as '-P'.
  3416. @\item
  3417.   {\bf StandAlone:} Runs the driver in a Stand alone mode. Otherwise, the
  3418.         driver will attempt to communicate with the {\em IRIT} server. Same
  3419.         as '-s'.
  3420. @\item
  3421.   {\bf TransMode:} Selects between object space transformations and screen
  3422.         space transformation.
  3423. @\item
  3424.   {\bf ViewMode:} Selects between perspective and orthographic views.
  3425. @\item
  3426.   {\bf NormalLength:} Sets the length of the drawn normals in thousandths of
  3427.         a unit. Same as '-L'.
  3428. @\item
  3429.   {\bf DebugObjects:} Debug objects. Prints to stderr all objects read
  3430.         from the communcation port with the server {\em IRIT}. Same as '-d'.
  3431. @\item
  3432.   {\bf DebugEchoInput:} Debug input. Prints to stderr all characters read
  3433.         from the communcation port with the server {\em IRIT}. Lowest level of
  3434.         communications.
  3435. @\end{itemize}
  3436. @\subsection{Interactive mode setup}
  3437. !Interactive mode setup
  3438.    Commands that affect the status of the display device can also be sent
  3439.  via the communication port with the {\em IRIT} server. The following commands
  3440.  are recognized,
  3441. # 16 2 0 1
  3442.  {\bf CLEAR}
  3443.   Clears the display area. All objects displayed are deleted.
  3444.  {\bf DCLEAR}
  3445.   Delayed clear. Same as CLEAR but delayed until the next
  3446.   object is sent from the server. Useful for animation.
  3447.  {\bf DISCONNECT}
  3448.   Closes connection with the server, but does not quit.
  3449.  {\bf EXIT}
  3450.   Closes connection with the server and quits.
  3451.  {\bf MSAVE NAME}
  3452.   Saves the transformation matrix file by the name NAME.
  3453.  {\bf BEEP}
  3454.   Makes some sound.
  3455.  {\bf STATE COMMAND}
  3456.   Changes the state of the display device. See below.
  3457.    The following commands are valid for the STATE COMMAND above,
  3458. # 16 2 0 1
  3459.  {\bf MoreSense:}
  3460.    More sensitive mouse control.
  3461.  {\bf LessSense:}
  3462.    Less sensitive mouse control.
  3463.  {\bf ScrnObject:}
  3464.    Toggle screen/object transformation mode.
  3465.  {\bf PerspOrtho:}
  3466.    Toggles perspective/orthographic trans. mode.
  3467.  {\bf DepthCue:}
  3468.    Toggles depth cueing drawing.
  3469.  {\bf DrawSolid:}
  3470.    Toggles isocurve/shaded solid drawing.
  3471.  {\bf DblBuffer:}
  3472.    Toggles single/double buffer mode.
  3473.  {\bf AntiAlias:}
  3474.    Toggles anti aliased lines.
  3475.  {\bf DrawIntrnl:}
  3476.    Toggles drawing of internal lines.
  3477.  {\bf DrawVNrml:}
  3478.    Toggles drawing of normals of vertices.
  3479.  {\bf DrawPNrml:}
  3480.    Toggles drawing of normals of polygons.
  3481.  {\bf DSrfMesh:}
  3482.    Toggles drawing of control meshes/polygons.
  3483.  {\bf DSrfPoly:}
  3484.    Toggles drawing of curves/surfaces.
  3485.  {\bf 4PerFlat:}
  3486.    Toggles 2/4 polygons per flat surface regions.
  3487.  {\bf MoreIso:}
  3488.    Doubles the number of isolines in a surface.
  3489.  {\bf LessIso:}
  3490.    Halves the number of isolines in a surface.
  3491.  {\bf FinrAprx:}
  3492.    Doubles the number of samples per curve.
  3493.  {\bf CrsrAprx:}
  3494.    Halves the number of samples per curve.
  3495.  {\bf LngrVecs:}
  3496.    Doubles the length of displayed normal vectors.
  3497.  {\bf ShrtrVecs:}
  3498.    Halves the length of displayed normal vectors.
  3499.  {\bf WiderLns:}
  3500.    Doubles the width of the drawn lines.
  3501.  {\bf NarrwLns:}
  3502.    Halves the width of the drawn lines.
  3503.  {\bf FinrAdapIso:}
  3504.    Doubles the number of adaptive isocurves.
  3505.  {\bf CrsrAdapIso:}
  3506.    Halves the number of adaptive isocurves.
  3507.  {\bf FinerRld:}
  3508.    Doubles the number of ruled surfaces in adaptive isocurves.
  3509.  {\bf CrsrRld:}
  3510.    Halves the number of ruled surfaces in adaptive isocurves.
  3511.  {\bf RuledSrfApx:}
  3512.    Toggles ruled surface approximation in adaptive isocurves.
  3513.  {\bf AdapIsoDir:}
  3514.    Toggles the row/col direction of adaptive isocurves.
  3515.  {\bf Front:}
  3516.    Selects a front view.
  3517.  {\bf Side:}
  3518.    Selects a side view.
  3519.  {\bf Top:}
  3520.    Selects a top view.
  3521.  {\bf Isometry:}
  3522.    Selects an isometric view.
  3523.  Obviously not all state options are valid for all drivers.
  3524.    The {\em IRIT} server defines in iritinit.irt several user-defined
  3525.  functions that exercise some of the above state commands, such as
  3526.  VIEWSTATE and VIEWSAVE.
  3527.    In addition to state modification via communication with the {\em IRIT}
  3528.  server, modes can be interactively modified on most of the display devices
  3529.  using a pop-up menu that is activated using the {\em right button in the
  3530.  transformation window}.
  3531.    This pop up menu is somewhat different in different drivers, but its
  3532.  entries closely follow the entries of the above state command table.
  3533. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3534. @\section{Utilities - General Usage}
  3535. !Utilities - General Usage
  3536.    The {\em IRIT} solid modeler is accompanied by quite a few utilities. They
  3537.  can be subdivided into two major groups. The first includes auxiliary tools
  3538.  such as illustrt and poly3d-h. The second includes filters such as irit2ray
  3539.  and irit2ps.
  3540.    All these tools operate on input files, and most of the time produce
  3541.  data files. In all utilities that read files, the dash ('-') can be used
  3542.  to read stdin.
  3543.  Example:
  3544. @\begin{verbatim}
  3545.  poly3d-h solid1.dat | irit2ps - > solid1.ps
  3546. @\end{verbatim}
  3547.    All the utilities have command line options. If an option is set by a '-x'
  3548.  then '-x-' resets the option. The command line options overwrite the settings
  3549.  in config files, and the reset option is useful for cases where the option
  3550.  is set by default, in the configuration file.
  3551.    All utilities can read a sequence of data files. However, the {\em last}
  3552.  transformation matrices found (VIEW\_MAT and PRSP\_MAT) are actually used.
  3553.  Example:
  3554. @\begin{verbatim}
  3555.  poly3d-h solid1.dat | x11drvs solid1.dat - solid1.mat 
  3556. @\end{verbatim}
  3557.  x11drvs will display the original solid1.dat file with its hidden version,
  3558.  as computed by poly3d-h, all with the solid1.mat, ignoring all other matrices
  3559.  in the data stream.
  3560.  Under unix, compressed files with a postfix ".Z" will be {\em automatically}
  3561.  uncompressed on read and write. The following is legal under unix,
  3562. @\begin{verbatim}
  3563.  poly3d-h solid1.dat.Z | x11drvs solid1.dat.Z - solid1.mat
  3564. @\end{verbatim}
  3565.  where solid1.dat.Z was saved from within IRIT using the command
  3566. @\begin{verbatim}
  3567.  save( "solid1.dat.Z", solid1 );
  3568. @\end{verbatim}
  3569.  or similar. The unix system's "compress" and "zcat" are used for the purpose
  3570.  of (un)compressing the data via pipes. See also SAVE and LOAD.
  3571. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3572. @\section{poly3d - A Data Display Program}
  3573. !poly3d - A Data Display Program
  3574.  This program has been retired. The display devices should be used instead.
  3575.  See the display drivers section.
  3576. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3577. @\section{poly3d-h - Hidden Line Removing Program}
  3578. !poly3d-h - Hidden Line Removing Program
  3579. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3580. @\subsection{Introduction}
  3581. &Introduction
  3582.     poly3d-h is a program to remove hidden lines from a given polygonal model.
  3583.  Freeform objects are preprocessed into polygons with controlled fineness.
  3584.     The program performs 4 passes over the input:
  3585.  1. Preprocesses and maps all polygons in a scene, and sorts them.
  3586.  2. Generates edges out of the polygonal model and sorts them (preprocessing
  3587.     for the scan line algorithm) into buckets.
  3588.  3. Intersects edges, and splits edges with non-homogeneous visibility (the
  3589.     scan line algorithm).
  3590.  4. Applies a visibility test of each edge.
  3591.         This program can handle CONVEX polygons only. From {\em IRIT} one can
  3592.  ensure that a model consists of convex polygons only using the CONVEX command:
  3593. @\begin{verbatim}
  3594.   CnvxObj = convex( Obj );
  3595. @\end{verbatim}
  3596.  just before saving it into a file. Surfaces are always decomposed into
  3597.  triangles.
  3598.     poly3d-h output is in the form of polylines. It is a regular {\em IRIT} data
  3599.  file that can be viewed using any of the display devices, for example.
  3600. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3601. @\subsection{Command Line Options}
  3602. &Command line options
  3603. @\begin{verbatim}
  3604.  poly3d-h [-b] [-m] [-i] [-e #Edges] [-f FineNess] [-H] [-4] [-q] [-z] [-c]
  3605.                                            [-o OutName] DFiles > OutFile
  3606. @\end{verbatim}
  3607. @\begin{itemize}
  3608. @\item
  3609.   {\bf -b}: BackFacing - if an object is closed (such as most models created by
  3610.        {\em IRIT}), back facing polygons can be deleted, therefore speeding up
  3611.        the process by at least a factor of two.
  3612. @\item
  3613.   {\bf -m}: More - provides some more information on the data file(s) parsed.
  3614. @\item
  3615.   {\bf -i}: Internal edges (created by {\em IRIT}) - default is not to
  3616.        display them, and this option will force displaying them as well.
  3617. @\item
  3618.   {\bf -e n}: Number of edges to use from each given polygon (default all).
  3619.        Handy as '-e 1 -4' for freeform data.
  3620. @\item
  3621.   {\bf -f FineNess}: Controls the fineness of the surface to polygon subdivision.
  3622.        This number is log based 2 of roughly the number of subdivisions of
  3623.        the surface in each axis.
  3624. @\item
  3625.   {\bf -H}: Dumps both visible lines and hidden lines as separated objects.
  3626.        Hidden lines will be dumped using a different (dimmer) color and (a
  3627.        narrower) line width.
  3628. @\item
  3629.   {\bf -4}: Forces four polygons per almost flat region in the surface to
  3630.        polygon conversion. Otherwise two polygons only.
  3631. @\item
  3632.   {\bf -q}: Quiet mode. No printing aside from fatal errors. Disables -m.
  3633. @\item
  3634.   {\bf -o OutName}: Name of output file. Default is stdout.
  3635. @\item
  3636.   {\bf -z}: Prints version number and current defaults.
  3637. @\item
  3638.   {\bf -c}: Clips data to screen (default). If disabled ('-c-'), data
  3639.        outside the view screen ([-1, 1] in x and y) are also processed.
  3640. @\end{itemize}
  3641.    Some of the options may be turned on in poly3d-h.cfg. They can be then
  3642.  turned off in the command line as '-?-'.
  3643. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3644. @\subsection{Configuration}
  3645. &Configuration
  3646.    The program can be configured using a configuration file named poly3d-h.cfg.
  3647.    This is a plain ASCII file you can edit directly and set the parameters
  3648.  according to the comments there. 'poly3d-h -z' will display the current
  3649.  configuration as read from the configuration file.
  3650.    The configuration file is searched in the directory specified by the
  3651.  IRIT\_PATH environment variable. For example,
  3652.  'setenv IRIT\_PATH /u/gershon/irit/bin/'.
  3653.    If the IRIT\_PATH variable is not set, the current directory is searched.
  3654. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3655. @\subsection{Usage}
  3656. &Usage
  3657.    As this program is not interactive, usage is quite simple, and the only
  3658.  control available is using the command line options.
  3659. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3660. @\section{poly3d-r - A Simple Data Rendering Program}
  3661. !poly3d-r - A Simple Data Rendering Program
  3662. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3663. @\subsection{Introduction}
  3664. &Introduction
  3665.  poly3d-r is a simple rendering program for data files created by the {\em IRIT}
  3666.  solid modeler. poly3d-r generates GIF images with 8 bits per pixel. As a
  3667.  result, rendered images are of medium quality. Although reasonably fast,
  3668.  one should consider one of several raytracing public domain programs
  3669.  available (such as RAYSHADE, for which irit2ray can generate data) for
  3670.  high quality images.
  3671.    poly3d-r uses cosine shading approximation, and flat/Gouraud interpolation.
  3672.  The program performs 4 passes over the input:
  3673.  1. Processes the input (parsing.)
  3674.  2. Prepares the polygons by sorting them by their Y after mapping then into
  3675.     screen space.
  3676.  3. Evaluates colors for vertices (using polygon normals if flat shading, or
  3677.     by vertex normals for Gouraud shading).
  3678.  4. Scans the data in a scan line fashion and dumps out the image.
  3679.         This program can handle CONVEX polygons only. From {\em IRIT} one can
  3680.  ensure that a model consists of convex polygons only using the CONVEX command:
  3681. @\begin{verbatim}
  3682.   CnvxObj = convex( Obj );
  3683. @\end{verbatim}
  3684.  just before saving it into a file. Surfaces are always decomposed into
  3685.  triangles.
  3686. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3687. @\subsection{Command Line Options}
  3688. &Command line options
  3689. @\begin{verbatim}
  3690.  poly3d-r [-a Ambient] [-c N] [-l X Y Z] [-2] [-m] [-s Xsize Ysize]
  3691.        [-S SubSample] [-g] [-b] [-M Mask] [-f FineNess] [-z] DFiles > Image.gif
  3692. @\end{verbatim}
  3693. @\begin{itemize}
  3694. @\item
  3695.   {\bf -a Ambient}: Sets the ambient intensity (must be between 0.0 and 1.0).
  3696. @\item
  3697.   {\bf -c N}: number of bits per pixel N (must be between 1 and 8 bits).
  3698. @\item
  3699.   {\bf -l X Y Z}: specifies the light source normal direction. This vector
  3700.      does not have to be a unit vector. Only one light source is supported.
  3701. @\item
  3702.   {\bf -2} : Forces emulation of 2 light sources at opposite directions as
  3703.      selected via [-l]. This may be useful for models that have no plane
  3704.      specified (i.e., the models has no PLANE attribute for their polygons),
  3705.      as the program guesses the equation from the points themselves, and
  3706.      which can be in the opposite of the desired direction.
  3707. @\item
  3708.   {\bf -m}: More - provides some more information on the data file(s) parsed.
  3709. @\item
  3710.   {\bf -s Xsize Ysize}: specifies image dimensions. As the models created by {\em IRIT}
  3711.      are mapped to a unit domain (X in [-1..1], Y in [-1..1]) by the
  3712.      viewing matrix, objects must be scaled up. The scaling up factor is
  3713.      MIN(Xsize, Ysize), which guarantees none of the original image will be
  3714.      clipped.
  3715. @\item
  3716.   {\bf -b}: Purges back facing polygons. If the scene contains closed objects
  3717.      (such as the ones usually created by {\em IRIT}), the back facing
  3718.      polygons can be deleted. This would not change the image, but will
  3719.      speed up the process by about \%15. Using this option for incomplete
  3720.      boundary objects and/or objects with polygons with no PLANE specified
  3721.      will almost definitely create an incorrect image.
  3722. @\item
  3723.   {\bf -g}: Use Gouraud shading interpolation (flat shading is used by default).
  3724.      This is somewhat slower, but creates nicer results.
  3725. @\item
  3726.   {\bf -S SubSample}: subsamples, and uses a box filter to low-pass filter the
  3727.      image, using a grid size of SubSample by SubSample.
  3728.      This obviously makes things slower, but guess what - it looks much better.
  3729. @\item
  3730.   {\bf -M Mask}: Creates a second GIF file named Mask that is a binary image set
  3731.      to 1 at any pixel covered by one of the objects, and 0 otherwise. As a
  3732.      color of an object can become equal to the background at some point,
  3733.      there is no way to find whether a pixel is representing the background
  3734.      or an object in the background color. The Mask can be used instead. This
  3735.      Mask can be used when combining images (such as the gifcomp utility in
  3736.      gif\_lib). This image is a binary alpha channel.
  3737. @\item
  3738.   {\bf -f FineNess}: Controls the fineness of the surface to polygon subdivision.
  3739.      This number is log based 2 of roughly the number of subdivisions of
  3740.      the surface in each axis (see cagd\_lib for more).
  3741. @\item
  3742.   {\bf -z}: Prints version number and current defaults.
  3743. @\end{itemize}
  3744.    The image is dumped to stdout as a GIF image which can be redirected to a
  3745.  file or piped to any program that reads GIF images from stdin.
  3746.    Some of the options may be turned on in poly3d-r.cfg. They can be then
  3747.  turned off in the command line as -?-.
  3748. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3749. @\subsection{Configuration}
  3750. &Configuration
  3751.    The program can be configured using a configuration file named poly3d-r.cfg.
  3752.    This is a plain ASCII file you can edit directly and set the parameters
  3753.  according to the comments there. 'poly3d-r -z' will display the current
  3754.  configuration as read from the configuration file.
  3755.    The configuration file is searched in the directory specified by the
  3756.  IRIT\_PATH environment variable. For example
  3757.  'setenv IRIT\_PATH /u/gershon/irit/bin/'.
  3758.    If the IRIT\_PATH variable is not set, the current directory is searched.
  3759. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3760. @\subsection{Usage}
  3761. &Usage
  3762.    As this program is not interactive, usage is quite simple, and the only
  3763.  control available is using the command lines options.
  3764.    Some Remarks:
  3765.   1. If the input file is degenerate (2 vertices are identical, etc.), the
  3766.      degenerate data will be ignored in the next passes. Use [-m] if you want
  3767.      to know about them.
  3768.   2. The color of the object can be extracted via the COLOR attribute as set
  3769.      via the {\em IRIT} COLOR command. In addition to this fixed set of colors, one
  3770.      can specify the color in RGB space using the ATTRIB command.
  3771.  Example:
  3772. @\begin{verbatim}
  3773.      attrib( Srf17, "rgb", "255,155,55" );
  3774. @\end{verbatim}
  3775.      Each of R G B must be an integer in the range [0..255].
  3776. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3777. @\section{Illustrt - Simple line illustration filter}
  3778. !Illustrt - Simple line illustration filter
  3779. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3780. @\subsection{Introduction}
  3781. &Introduction
  3782.  illustrt is a filter that processes IRIT data files and dumps out modified
  3783.  IRIT data files. illustrt can be used to make simple nice illustrations of
  3784.  data. The features of illustrt include depth sorting, hidden line clipping 
  3785.  at intersection points, and vertex enhancements. illustrt is designed to
  3786.  closely interact with irit2ps, although it is not neceessary to use irit2ps
  3787.  on illustrt output.
  3788. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3789. @\subsection{Command Line Options}
  3790. &Command line options
  3791. @\begin{verbatim}
  3792.    illustrt [-I #IsoLines] [-S #SampPerCrv] [-s] [-M] [-P] [-p]
  3793.             [-l MaxLnLen] [-a] [-t TrimInter] [-o OutName] [-T] [-z] DFiles
  3794. @\end{verbatim}
  3795. @\begin{itemize}
  3796. @\item
  3797.   {\bf -I \#IsoLines}: Specifies number of isolines per surface, per direction.
  3798. @\item
  3799.   {\bf -S \#SampPerCrv}: Specifies the log based 2 of number of samples per
  3800.         (iso)curve.
  3801. @\item
  3802.   {\bf -s}: sorts the data in Z depth order that emulates hidden line removal
  3803.         once the data are drawn.
  3804. @\item
  3805.   {\bf -M}: Dumps the control mesh/polygon as well.
  3806. @\item
  3807.   {\bf -P}: Dumps the curve/surface as isocurves.
  3808. @\item
  3809.   {\bf -p}: Dumps vertices of polygons/lines as points.
  3810. @\item
  3811.   {\bf -l MaxLnLen}: breaks long lines into shorter ones with maximal length
  3812.         of MaxLnLen. This option is necessary to achieve good depth depending
  3813.         line width in the '-d' option of irit2ps.
  3814. @\item
  3815.   {\bf -a}: takes into account the angle between the two (poly)lines that
  3816.         intersect when computing how much to trim. See also -t.
  3817. @\item
  3818.   {\bf -t TrimInter}: Each time two (poly)line segments intersect in the
  3819.         projection plane, the (poly)line that is farther away from the
  3820.         viewer is clipped TrimInter amount from both sides. See also -a.
  3821. @\item
  3822.   {\bf -o OutName}: Name of output file. Default is stdout.
  3823. @\item
  3824.   {\bf -T}: Talkative mode. Prints processing information.
  3825. @\item
  3826.   {\bf -z}: Prints version number and current defaults.
  3827. @\end{itemize}
  3828. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3829. @\subsection{Usage}
  3830. &Usage
  3831.     illustrt is a simple line illustration tool. It process geometry such
  3832.  as polylines and surfaces and dumps geometry with attributes that will make
  3833.  nice line illustrations. illustrt is geared mainly toward its use with
  3834.  irit2ps to create postscript illustrations. Here is a simple example:
  3835. @\begin{verbatim}
  3836.  illustrt -s -l 0.1 solid1.dat | irit2ps -W 0.05 -d 0.2 0.6 -u - > solid.ps
  3837. @\end{verbatim}
  3838.  make sure all segments piped into irit2ps are shorter than 0.1 and sort them
  3839.  in order to make sure hidden surface removal is correctly applied. Irit2ps
  3840.  is invoked with depth cueing activated, and a default width of 0.05.
  3841.     illustrt dumps out regular {\em IRIT} data files, so output can be handled
  3842.  like any other data set. illustrt does the following processing to the input
  3843.  data set:
  3844. @\begin{itemize}
  3845. @\item
  3846.   Converts surfaces to isocurves ('-I' flag) and isocurves and curves to
  3847.   polylines ('-S' flag), and converts polygons to polylines.
  3848.     Polygonal objects are considered closed and even though each edge is
  3849.   shared by two polygons, only a single one is generated.
  3850. @\item
  3851.   Finds the intersection location in the projection plane of all segments in
  3852.   the input data set and trims away the far segment at both sides of the
  3853.   intersection point by an amount controlled by the '-t' and '-a' flags.
  3854. @\item
  3855.   Breaks polylines and long lines into short segments, as specified via the
  3856.   '-l' flag, so that width depth cueing can be applied more accurately
  3857.   (see irit2ps's '-d' flag) as well as the Z sorting.
  3858. @\item
  3859.   Generates vertices of polygons in the input data set as points in output data
  3860.   controlled via the '-p' flag.
  3861.   set.
  3862. @\item
  3863.   Applies a Z sort to the output data, if '-s', so drawing in order of the data
  3864.   will produce a properly hidden surface removal drawing.
  3865. @\end{itemize}
  3866.  Here is a more complex example. Make sure tubular is properly set via
  3867.  "attrib(solid1, "tubular", 0.7);" and invoke:
  3868. @\begin{verbatim}
  3869.  illustrt -s -p -l 0.1 -t 0.05 solid1.dat |
  3870.      irit2ps -W 0.05 -d 0.2 0.6 -p h 0.05 -u - > solid.ps
  3871. @\end{verbatim}
  3872.  makes sure all segments piped into irit2ps are shorter than 0.1, generates
  3873.  points for the vertices, sorts the data in order to make sure hidden surface
  3874.  removal is correctly applied, and trims the far edge by 0.05 at an
  3875.  intersection point. Irit2ps is invoked with depth cueing activated and a
  3876.  default width of 0.05, points are drawn as hollowed circles of default
  3877.  size 0.05, and lines are drawn tubular.
  3878. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3879. @\section{Dat2Irit - Data To IRIT file filter}
  3880. !DAT2IRIT - Data To IRIT file filter
  3881. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3882. @\subsection{Command Line Options}
  3883. &Command line options
  3884. @\begin{verbatim}
  3885.    dat2irit [-z] DFiles
  3886. @\end{verbatim}
  3887. @\begin{itemize}
  3888. @\item
  3889.   {\bf -z}: Print version number and current defaults.
  3890. @\end{itemize}
  3891. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3892. @\subsection{Usage}
  3893. &Usage
  3894.     It may be sometimes desired to convert .dat data files into a form that
  3895.  can be fed back to {\em IRIT} - a '.irt' file. This filter does exactly that.
  3896.  Example:
  3897. @\begin{verbatim}
  3898.    dat2irit b58.dat > b58-new.irt
  3899. @\end{verbatim}
  3900. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3901. @\section{Dxf2Irit - DXF (Autocad) To IRIT filter}
  3902. !DXF2IRIT - DXF (Autocad) To IRIT filter
  3903.    Due to lack of real documentation on the DXF format (for surfaces), this
  3904.  filter is not really complete. It only work for polygons, and is provided
  3905.  here only for those desperate enough to try and fix it...
  3906. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3907. @\section{Irit2Dxf - IRIT To DXF (Autocad) filter}
  3908. !IRIT2DXF - IRIT To DXF (Autocad) filter
  3909.    Due to lack of real documentation on the DXF format (for surfaces), this
  3910.  filter is not really complete. It works only for polygons, and is provided
  3911.  here only for those desperate enough to try and fix it...
  3912. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3913. @\section{Irit2Nff - IRIT To NFF filter}
  3914. !IRIT2NFF - IRIT To NFF filter
  3915. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3916. @\subsection{Command Line Options}
  3917. &Command line options
  3918. @\begin{verbatim}
  3919.   irit2nff [-l] [-4] [-c] [-f FineNess] [-o OutName] [-T] [-g] [-z] DFiles
  3920. @\end{verbatim}
  3921. @\begin{itemize}
  3922. @\item
  3923.   {\bf -l}: Linear - forces linear (degree two) surfaces to be approximated
  3924.        by a single polygon along their linear direction.
  3925.        Although, most of the time, linear direction can be exactly represented
  3926.        using a single polygon, even a bilinear surface can have a free-form
  3927.        shape (saddle-like) that is not representable using a single polygon.
  3928.        Note that although this option will better emulate the surface shape,
  3929.        it will create unnecessary polygons in cases where one is enough.
  3930. @\item
  3931.   {\bf -4}: Four - Generates four polygons per flat patch. Default is 2.
  3932. @\item
  3933.   {\bf -c}: Output files should be filtered by cpp. When set, the usually
  3934.        huge geometry file is separated from the main nff file that contains
  3935.        the surface properties and view parameters. By default all data,
  3936.        including the geometry, are saved into a single file with type extension
  3937.        '.nff'. Use of '-c' will pull out all the geometry into a file with
  3938.        the same name but a '.geom' extension, which will be included using the
  3939.        '\#include' command. The '.nff' file should, in that case, be
  3940.        preprocessed using cpp before being piped into the nff renderer.
  3941. @\item
  3942.   {\bf -f FineNess}: An integer value controlling the fineness of surface to
  3943.        polygons process. Roughly speaking, it sets the number of polygons
  3944.        along one Bezier patch direction. A Bezier patch will have order of
  3945.        $FineNess^2$ polygons then. The order of the surface also affects the
  3946.        amount of polygons; the higher the order is, the more polygons are
  3947.        created. A Bspline surface is first converted into piecewise Bezier
  3948.        to make sure C1 discontinuities will show up in the polygonal
  3949.        approximation.
  3950. @\item
  3951.   {\bf -o OutName}: Name of output file. By default the name of the first data
  3952.        file from the {\em DFiles} list is used.  See below on the output files.
  3953. @\item
  3954.   {\bf -g}: Generates the geometry file only. See below.
  3955. @\item
  3956.   {\bf -T}: Talkative mode. Prints processing information.
  3957. @\item
  3958.   {\bf -z}: Prints version number and current defaults.
  3959. @\end{itemize}
  3960. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3961. @\subsection{Usage}
  3962. &Usage
  3963.     Irit2Nff converts freeform surfaces into polygons in a format that can
  3964.  be used by an NFF renderer. Usually, one file is created with '.nff' type
  3965.  extension. Since the number of polygons can be extremely large, a '-c'
  3966.  option is provided, which separates the geometry from the surface
  3967.  properties and view specification, but requires preprocessing by cpp.
  3968.  The geometry is isolated in a file with extension '.geom' and included
  3969.  (via '\#include') in the main '.nff' file. The latter holds the surface
  3970.  properties for all the geometry as well as the viewing specification.
  3971.  This allows for the changing of shading or the viewing properties while
  3972.  editing small ('.nff') files.
  3973.     If '-g' is specified, only the '.geom' file is created, preserving the
  3974.  current '.nff' file. The '-g' flag can be specified only with '-c'.
  3975.     In practice, it may be useful to create a low resolution approximation
  3976.  of the model, change viewing/shading parameters in the '.nff' file until
  3977.  a good view and/or surface quality is found, and then run Irit2Nff once more
  3978.  to create a high resolution approximation of the geometry using '-g'.
  3979.  Example:
  3980. @\begin{verbatim}
  3981.  irit2nff -c -l -f 5 b58.dat
  3982. @\end{verbatim}
  3983.  creates b58.nff and b58.geom with low resolution (FineNess of 5).
  3984.  Once done with parameter setting, a fine approximation of the model can
  3985.  be created with:
  3986. @\begin{verbatim}
  3987.  irit2nff -c -l -g -f 25 b58.dat
  3988. @\end{verbatim}
  3989.  which will only recreate b58.geom (because of the -g option).
  3990.  One can overwrite the viewing matrix by appending a new matrix in the
  3991.  end of the command line, created by a display device:
  3992. @\begin{verbatim}
  3993.  xgldrvs b58.dat
  3994.  irit2nff -l -f 5 b58.dat irit.mat
  3995. @\end{verbatim}
  3996.  where irit.mat is the viewing matrix created by xgldrvs.
  3997. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3998. @\subsection{Advanced Usage}
  3999. &Advanced Usage
  4000.    One can specify surface qualities for individual surfaces of a model.
  4001.  Several such attributes are supported by Irit2Nff and can be set within
  4002.  {\em IRIT}. See also the ATTRIB {\em IRIT} command.
  4003.    If a certain surface should be finer than the rest of the scene, one can
  4004.  set a "resolution" attribute which specifies the {\em relative} FineNess
  4005.  resolution of this specific surface.
  4006.  Example:
  4007. @\begin{verbatim}
  4008.  attrib( srf1, "resolution", 2 );
  4009. @\end{verbatim}
  4010.  will force srf1 to have twice the default resolution, as set via the '-f'
  4011.  flag.
  4012.    Almost flat patches are converted to polygons. The rectangle can be
  4013.  converted into two polygons (by subdividing along one of its diagonals) or
  4014.  into four by introducing a new point at the center of the patch. This
  4015.  behavior is controlled by the '-4' flag, but can be overwritten for
  4016.  individual surfaces by setting a "twoperflat" or a "fourperflat" attribute.
  4017.    NFF specific properties are controlled via the following attributes:
  4018.  "kd", "ks", "shine", "trans", "index". Refer to the NFF manual for detail.
  4019.  Example:
  4020. @\begin{verbatim}
  4021.  attrib( srf1, "kd", 0.3 );
  4022.  attrib( srf1, "shine", 30 );
  4023. @\end{verbatim}
  4024.    Surface color is controlled in two levels. If the object has an RGB
  4025.  attribute, it is used. Otherwise, a color, as set via the {\em IRIT} COLOR
  4026.  command, is used if set.
  4027.  Example:
  4028. @\begin{verbatim}
  4029.  attrib( tankBody, "rgb", "244,164,96" );
  4030. @\end{verbatim}
  4031. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4032. @\section{Irit2Plg - IRIT To PLG (REND386) filter}
  4033. !IRIT2PLG - IRIT To PLG (REND386) filter
  4034.  PLG is the format used by the rend386 real time renderer for the IBM PC.
  4035. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4036. @\subsection{Command Line Options}
  4037. &Command line options
  4038. @\begin{verbatim}
  4039.   irit2plg [-l] [-4] [-f FineNess] [-T] [-z] DFiles
  4040. @\end{verbatim}
  4041. @\begin{itemize}
  4042. @\item
  4043.   {\bf -l}: Linear - forces linear (degree two) surfaces to be approximated
  4044.        by a single polygon along their linear direction.
  4045.        Although, most of the time, linear direction can be exactly represented
  4046.        using a single polygon, even a bilinear surface can have a free form
  4047.        shape (saddle like) that is not representable using a single polygon.
  4048.        Note that although this option will better emulate the surface shape,
  4049.        it will create unnecessary polygons in cases where one is enough.
  4050. @\item
  4051.   {\bf -4}: Four - Generates four polygons per flat patch. Default is 2.
  4052. @\item
  4053.   {\bf -f FineNess}: An integer value controlling the fineness of surface to
  4054.        polygons process. Roughly speaking, it sets the number of polygons
  4055.        along one Bezier patch direction. A Bezier patch will have order of
  4056.        $FineNess^2$ polygons then. The order of the surface also affects the
  4057.        amount of polygons; The higher the order is, more polygons are created.
  4058.        A Bspline surface is first converted into piecewise Bezier to make
  4059.        sure C1 discontinuities will show up in the polygonal approximation.
  4060. @\item
  4061.   {\bf -T}: Talkative mode. Prints processing information.
  4062. @\item
  4063.   {\bf -z}: Prints version number and current defaults.
  4064. @\end{itemize}
  4065. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4066. @\subsection{Usage}
  4067. &Usage
  4068.     Irit2Plg converts freeform surfaces and polygons into polygons in a
  4069.  format that can be used by the REND386 renderer. 
  4070.  Example:
  4071. @\begin{verbatim}
  4072.  irit2plg solid1.dat > solid1.plg
  4073. @\end{verbatim}
  4074.     Surfaces are converted to polygons with fineness control:
  4075. @\begin{verbatim}
  4076.  irit2plg -f 10 - view.mat < saddle.dat > saddle.plg
  4077. @\end{verbatim}
  4078.     Note the use of '-' for stdin.
  4079. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4080. @\section{Irit2Ps - IRIT To PS filter}
  4081. !IRIT2PS - IRIT To PS filter
  4082. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4083. @\subsection{Command Line Options}
  4084. &Command line options
  4085. @\begin{verbatim}
  4086.   irit2ps [-s Size] [-I #UIso[:#VIso]] [-S #SampPerCrv] [-M] [-P]
  4087.           [-W LineWidth] [-c] [-C] [-T] [-i] [-o OutName] [-d [Zmin Zmax]]
  4088.                       [-D [Zmin Zmax]] [-p PtType PtSize][-u] [-z] DFiles
  4089. @\end{verbatim}
  4090. @\begin{itemize}
  4091. @\item
  4092.   {\bf -s Size}: Controls the size of the postscript output in inches.
  4093.        Default is to fill the entire screen.
  4094. @\item
  4095.   {\bf -I \#UIso[:\#VIso]}: Specifies the number of isolines per surface, per
  4096.         direction. If \#VIso is not specified, \#UIso is used for \#VIso as
  4097.         well.
  4098. @\item
  4099.   {\bf -S \#SampPerCrv}: Specifies the log based 2 of number of samples per
  4100.         (iso)curve.
  4101. @\item
  4102.   {\bf -M}: Dumps the control mesh/polygon as well.
  4103. @\item
  4104.   {\bf -P}: Dumps the curve/surface as isocurves.
  4105. @\item
  4106.   {\bf -W \#LineWidth}: Sets the line drawing width in inches. Default is
  4107.         as thin as possible. This option will overwrite only those objects
  4108.         that do {\em not} have a "width" attribute. See also -d.
  4109. @\item
  4110.   {\bf -c}: Creates a {\em color} postscript file.
  4111. @\item
  4112.   {\bf -C}: Curve mode. Dumps freeform curves and surfaces as cubic
  4113.        Bezier curves. Higher order curves and surfaces and/or rationals are
  4114.        approximated by cubic Bezier curves. This option generates data
  4115.        files that are roughly a third of piecewise linear postscript files
  4116.        (by disabling this feature, -C-), but takes a longer time to compute.
  4117. @\item
  4118.   {\bf -T}: Talkative mode. Prints processing information.
  4119. @\item
  4120.   {\bf -i}: Internal edges (created by {\em IRIT}) - the default is not to
  4121.        display them, and this option will force displaying them as well.
  4122. @\item
  4123.   {\bf -o OutName}: Name of output file. Default is stdout.
  4124. @\item
  4125.   {\bf -d [Zmin Zmax]}: Sets the ratios between the depth cue and the width of
  4126.         the dumped data. See also -W, -p. Closer lines/points will be drawn
  4127.         wider/larger. Zmin and Zmax are optional. The object's bounding
  4128.         box is otherwise computed and used.
  4129. @\item
  4130.   {\bf -D [Zmin Zmax]}: Same as -d, but depth cue the color or gray scale
  4131.         instead of width. You might need to consider the sorting option
  4132.         of the illustrt tool (-s of illustrt) for proper drawings.
  4133.         Only one of -d and -D can be used.
  4134. @\item
  4135.   {\bf -p PtType PtSize}: Specifies the way points are drawn.
  4136.         PtType can be one of H, F, C for Hollow circle, Full Circle, or
  4137.         Cross. PtSize specifies the size of the point to be drawn, in inches.
  4138.         Vectors will also be drawn as points, but with an additional thin
  4139.         line to the origin. See also -d.
  4140. @\item
  4141.   {\bf -u}: Forces a unit matrix transformation, i.e. no transformation.
  4142. @\item
  4143.   {\bf -z}: Prints version number and current defaults.
  4144. @\end{itemize}
  4145. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4146. @\subsection{Usage}
  4147. &Usage
  4148.     Irit2Ps converts freeform surfaces and polygons into a postscript file.
  4149.  Example:
  4150. @\begin{verbatim}
  4151.  irit2ps solid1.dat > solid1.ps
  4152. @\end{verbatim}
  4153.     Surfaces are converted to polygons with fineness control:
  4154. @\begin{verbatim}
  4155.  irit2ps -S 5 -c -W 0.01 saddle.dat > saddle.ps
  4156. @\end{verbatim}
  4157.  creates a postscript file for the saddle model, in color, and with
  4158.  lines 0.01 inch thick.
  4159. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4160. @\subsection{Advanced Usage}
  4161. &Advanced Usage
  4162.    One can specify several attributes that affect the way the postscript
  4163.  file is generated. The attributes can be generated within {\em IRIT}.
  4164.  See also the ATTRIB {\em IRIT} command.
  4165.    If a certain object should be thinner or thicker than the rest of the scene,
  4166.  one can set a "width" attribute which specifies the line width in inches of
  4167.  this specific object.
  4168.  Example:
  4169. @\begin{verbatim}
  4170.  attrib( srf1, "width", 0.02 );
  4171. @\end{verbatim}
  4172.  will force srf1 to have this width, instead of the default as set via the
  4173.  '-W' flag.
  4174.  If a (closed) object, a polygon for example, needs to be filled, a "fill"
  4175.  attribute should be set, with a value equal to the gray level desired.
  4176.  Example:
  4177. @\begin{verbatim}
  4178.  attrib( poly, "fill", 0.5 );
  4179. @\end{verbatim}
  4180.  will fill poly with \%50 gray.
  4181.  Dotted or dashed line effects can be created using a "dash" attribute which
  4182.  is a direct PostScript dash string. A simple form of this string is "[a b]"
  4183.  in which a is the drawing portion (black) in inches, followed by b inches
  4184.  of white space. See the postScript manual for more about the format of this
  4185.  string. Here is an example for a dotted-dash line.
  4186. @\begin{verbatim}
  4187.  attrib( poly, "dash", "[0.006 0.0015 0.001 0.0015]" );
  4188. @\end{verbatim}
  4189.    Surface color is controlled (for color postscript only - see -c) in two
  4190.  levels. If the object has an RGB attribute, it is used. Otherwise, a color as
  4191.  set via the {\em IRIT} COLOR command is used.
  4192.  Example:
  4193. @\begin{verbatim}
  4194.  attrib( Ball, "rgb", "255,0,0" );
  4195. @\end{verbatim}
  4196.     An object can be drawn as ``tubes'' instead of full lines. The ratio
  4197.  between the inner and the outer radii of the tube is provided as the
  4198.  TUBULAR attribute:
  4199. @\begin{verbatim}
  4200.  attrib( final, "tubular", 0.7 );
  4201. @\end{verbatim}
  4202. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4203. @\section{Irit2Ray - IRIT To RAYSHADE filter}
  4204. !IRIT2RAY - IRIT To RAYSHADE filter
  4205. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4206. @\subsection{Command Line Options}
  4207. &Command line options
  4208. @\begin{verbatim}
  4209.   irit2ray [-l] [-4] [-G GridSize] [-f FineNess] [-o OutName] [-g]
  4210.     [-p Zmin Zmax] [-P] [-M] [-T] [-I #UIso[:#VIso]] [-S #SampPerCrv]
  4211.                                                             [-z] DFiles
  4212. @\end{verbatim}
  4213. @\begin{itemize}
  4214. @\item
  4215.   {\bf -l}: Linear - forces linear (degree two) surfaces to be approximated
  4216.        by a single polygon along their linear direction.
  4217.          Although most of the time, linear direction can be exactly represented
  4218.        using a single polygon, even a bilinear surface can have a free-form
  4219.        shape (saddle-like) that is not representable using a single polygon.
  4220.          Note that although this option will better emulate the surface shape,
  4221.        it will create unnecessary polygons in cases where one is enough.
  4222. @\item
  4223.   {\bf -4}: Four - Generates four polygons per flat patch. Default is 2.
  4224. @\item
  4225.   {\bf -G GridSize}: Usually objects are grouped as {\em lists} of polygons.
  4226.        This flags will coerce the usage of the RAYSHADE {\em grid} structure,
  4227.        with {\em GridSize} being used as the grid size along the object
  4228.        bounding box's largest dimension.
  4229. @\item
  4230.   {\bf -f FineNess}: An integer value controlling the fineness of surface to
  4231.        polygons process. Roughly speaking, it will be set to the number of
  4232.        polygons along one Bezier patch direction. A Bezier patch will have
  4233.        order of $FineNess^2$ polygons then. The order of the surface also
  4234.        affects the amount of polygons; The higher the order is, the more
  4235.        polygons are created. A Bspline surface is first converted into
  4236.        piecewise Bezier to make sure C1 discontinuities will show up in
  4237.        the polygonal approximation.
  4238. @\item
  4239.   {\bf -o OutName}: Name of output file. By default the name of the first data
  4240.        file from the {\em DFiles} list is used.  See below on the output files.
  4241. @\item
  4242.   {\bf -g}: Generates the geometry file only. See below.
  4243. @\item
  4244.   {\bf -p Zmin Zmax}: Sets the ratios between the depth cue and the width of
  4245.        the dumped {\em polylines}. See also -P. Closer lines will be drawn
  4246.        wider.
  4247. @\item
  4248.   {\bf -P}: Forces dumping polygons as polylines with thickness controlled
  4249.        by -p.
  4250. @\item
  4251.   {\bf -M}: If -P (see -P and -p) then converts the control mesh/polygon
  4252.        to polylines which are represented as a sequence of truncated
  4253.        cones.
  4254. @\item
  4255.   {\bf -T}: Talkative mode. Prints processing information.
  4256. @\item
  4257.   {\bf -I \#UIso[:\#VIso]}: Specifies the number of isolines per surface, per
  4258.        direction. If \#VIso is not specified, \#UIso is used for \#VIso as
  4259.        well.
  4260. @\item
  4261.   {\bf -S \#SampPerCrv}: Specifies the log based 2 of the number of samples per
  4262.        (iso)curve.
  4263. @\item
  4264.   {\bf -z}: Prints version number and current defaults.
  4265. @\end{itemize}
  4266. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4267. @\subsection{Usage}
  4268. &Usage
  4269.     Irit2Ray converts freeform surfaces into polygons in a format that can
  4270.  be used by RAYSHADE. Two files are created, one with a '.geom' extension and
  4271.  one with '.ray'. Since the number of polygons can be extremely large,
  4272.  the geometry is isolated in the '.geom' file and is included
  4273.  (via '\#include') in the main '.ray' file. The latter holds the surface
  4274.  properties for all the geometry as well as viewing and RAYSHADE specific
  4275.  commands. This allows for the changing of the shading or the viewing
  4276.  properties while editing small ('.ray') files.
  4277.     If '-g' is specified, only the '.geom' file is created, preserving the
  4278.  current '.ray' file.
  4279.     In practice, it may be useful to create a low resolution approximation
  4280.  of the model, change the viewing/shading parameters in the '.ray' file until
  4281.  a good view and/or surface quality is found, and then run Irit2Ray once more
  4282.  to create a high resolution approximation of the geometry using '-g'.
  4283.  Example:
  4284. @\begin{verbatim}
  4285.  irit2ray -l -f 5 b58.dat
  4286. @\end{verbatim}
  4287.  creates b58.ray and b58.geom with low resolution (FineNess of 5).
  4288.    At such low resolution it can very well may happen that triangles will have
  4289.  normals "over the edge" since a single polygon may approximate a highly
  4290.  curved surface. That will cause RAYSHADE to issue an
  4291.  "Inconsistent triangle normals" warning. This problem will not exist if
  4292.  high fineness is used.
  4293.    One can ray trace this scene using a command similar to:
  4294. @\begin{verbatim}
  4295.  RAYSHADE -p -W 256 256 b58.ray > b58.rle
  4296. @\end{verbatim}
  4297.  Once done with parameter setting for RAYSHADE, a fine approximation of the
  4298.  model can be created with:
  4299. @\begin{verbatim}
  4300.  irit2ray -l -g -f 25 b58.dat
  4301. @\end{verbatim}
  4302.  which will only recreate b58.geom (because of the -g option).
  4303.  Interesting effects can be created using the depth cue support and polyline
  4304.  conversion of irit2ray. For example
  4305. @\begin{verbatim}
  4306.  irit2ray -G 5 -P -p -0.0 0.5 solid1.dat
  4307. @\end{verbatim}
  4308.  will dump solid1 as a set of polylines (represented as truncated cones in
  4309.  RAYSHADE) with varying thickness according to the $z$ depth. Another example
  4310. @\begin{verbatim}
  4311.  irit2ray -G 5 -P -p -0.1 1.0 saddle.dat
  4312. @\end{verbatim}
  4313.  which dumps the isolines extracted from the saddle surface with varying
  4314.  thickness.
  4315.    Each time a data file is saved in {\em IRIT}, it can be saved with the
  4316.  viewing matrix of the last INTERACT by saving the VIEW\_MAT object as well.
  4317.  I.e.:
  4318. @\begin{verbatim}
  4319.  save( "b58", b58 );
  4320. @\end{verbatim}
  4321.    However one can overwrite the viewing matrix by appending a new matrix
  4322.  in the end of the command line, created by the display devices:
  4323. @\begin{verbatim}
  4324.  os2drvs b58.dat
  4325.  irit2ray -l -f 5 b58.dat irit.mat
  4326. @\end{verbatim}
  4327.  where irit.mat is the viewing matrix created by os2drvs. The output name,
  4328.  by default, is the last input file name, so you might want to provide an
  4329.  explicit name with the -o flag.
  4330. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4331. @\subsection{Advanced Usage}
  4332. &Advanced Usage
  4333.    One can specify surface qualities for individual surfaces of a model.
  4334.  Several such attributes are supported by Irit2Ray and can be set within
  4335.  {\em IRIT}. See also the ATTRIB {\em IRIT} command.
  4336.    If a certain surface should be finer than the rest of the scene, one can
  4337.  set a "resolution" attribute which specifies the {\em relative} FineNess
  4338.  resolution of this specific surface.
  4339.  Example:
  4340. @\begin{verbatim}
  4341.  attrib( srf1, "resolution", 2 );
  4342. @\end{verbatim}
  4343.  will force srf1 to have twice the default resolution, as set via the '-f'
  4344.  flag.
  4345.    Almost flat patches are converted to polygons. The rectangle can be
  4346.  converted into two polygons (by subdividing along one of its diagonals) or
  4347.  into four by introducing a new point at the patch center. This behavior is
  4348.  controlled by the '-4' flag, but can be overwritten for individual surfaces
  4349.  bu setting "twoperflat" or "fourperflat".
  4350.    RAYSHADE specific properties are controlled via the following attributes:
  4351.  "specpow", "reflect", "transp", "body", "index", and "texture". Refer to
  4352.  RAYSHADE manual for their meaning.
  4353.   Example:
  4354. @\begin{verbatim}
  4355.  attrib( srf1, "transp", 0.3 );
  4356.  attrib( srf1, "texture", "wood" );
  4357. @\end{verbatim}
  4358.    Surface color is controlled in two levels. If the object has an RGB
  4359.  attribute, it is used. Otherwise a color as set via the {\em IRIT} COLOR
  4360.  command is being used if set.
  4361.  Example:
  4362. @\begin{verbatim}
  4363.  attrib( tankBody, "rgb", "244,164,96" );
  4364. @\end{verbatim}
  4365. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4366. @\section{Irit2Scn - IRIT To SCENE (RTrace) filter}
  4367. !IRIT2Scn - IRIT To SCENE (RTrace) filter
  4368.  SCENE is the format used by the RTrace ray tracer. This filter was donated
  4369.  by Antonio Costa (acc@asterix.inescn.pt), the author of RTrace.
  4370. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4371. @\subsection{Command Line Options}
  4372. &Command line options
  4373. @\begin{verbatim}
  4374.   irit2scn [-l] [-4] [-f FineNess] [-o OutName] [-g] [-T] [-z] DFiles
  4375. @\end{verbatim}
  4376. @\begin{itemize}
  4377. @\item
  4378.   {\bf -l}: Linear - forces linear (degree two) surfaces to be approximated
  4379.        as a single polygon along their linear direction.
  4380.          Although most of the time, linear direction can be exactly represented
  4381.        using a single polygon, even a bilinear surface can have a free-form
  4382.        shape (saddle-like) that is not representable using a single polygon.
  4383.          Note that although this option will better emulate the surface shape,
  4384.        it will create unnecessary polygons in cases where one is enough.
  4385. @\item
  4386.   {\bf -4}: Four - Generates four polygons per flat patch.
  4387. @\item
  4388.   {\bf -f FineNess}: An integer value controlling the fineness of surface to
  4389.        polygons process. Roughly speaking, it will be set to the number of
  4390.        polygons along one Bezier patch direction. A Bezier patch will have
  4391.        order of $FineNess^2$ polygons then. The order of the surface also
  4392.        affects the amount of polygons; The higher the order is, the more
  4393.        polygons are created. A Bspline surface is first converted into
  4394.        piecewise Bezier to make sure C1 discontinuities will show up in
  4395.        the polygonal approximation.
  4396. @\item
  4397.   {\bf -o OutName}: Name of output file. By default the name of the first data
  4398.        file from {\em DFiles} list is used.  See below on the output files.
  4399. @\item
  4400.   {\bf -g}: Generates the geometry file only. See below.
  4401. @\item
  4402.   {\bf -T}: Talkative mode. Prints processing information.
  4403. @\item
  4404.   {\bf -z}: Prints version number and current defaults.
  4405. @\end{itemize}
  4406. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4407. @\subsection{Usage}
  4408. &Usage
  4409.     Irit2Scn converts freeform surfaces and polygons into polygons in a format
  4410.  that can be used by RTrace. Two files are created, one with a '.geom'
  4411.  extension and one with '.scn'. Since the number of polygons can be extremely
  4412.  large, the geometry is isolated in the '.geom' file and is included
  4413.  (via '\#include') in the main '.scn' file. The latter holds the surface
  4414.  properties for all the geometry as well as viewing and RTrace specific
  4415.  commands. This allows for the changing of the shading or the viewing
  4416.  properties while editing small ('.scn') files.
  4417.     If '-g' is specified, only the '.geom' file is created, preserving the
  4418.  current '.scn' file.
  4419.     In practice, it may be useful to create a low resolution approximation
  4420.  of the model, change the viewing/shading parameters in the '.scn' file
  4421.  until a good view and/or surface quality is found, and then run Irit2Scn once
  4422.  more to create a high resolution approximation of the geometry using '-g'.
  4423.  Example:
  4424. @\begin{verbatim}
  4425.  irit2scn -l -f 5 b58.dat
  4426. @\end{verbatim}
  4427.  creates b58.scn and b58.geom with low resolution (FineNess of 5).
  4428.    One can ray trace this scene after converting the scn file to a sff file,
  4429.  using scn2sff provided with the RTrace package.
  4430.  Once done with the parameter setting of RTrace, a fine approximation of the
  4431.  model can be created with:
  4432. @\begin{verbatim}
  4433.  irit2scn -l -g -f 25 b58.dat
  4434. @\end{verbatim}
  4435.  which will only recreate b58.geom (because of the -g option).
  4436.    One can overwrite the viewing matrix by appending a new matrix
  4437.  in the end of the command line, created by the display devices:
  4438. @\begin{verbatim}
  4439.  wntdrvs b58.dat
  4440.  irit2scn -l -f 5 b58.dat irit.mat
  4441. @\end{verbatim}
  4442.  where irit.mat is the viewing matrix created by wntdrvs. The output name,
  4443.  by default, is the last input file name, so you might want to provide an
  4444.  explicit name with the -o flag.
  4445. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4446. @\subsection{Advanced Usage}
  4447. &Advanced Usage
  4448.    One can specify surface qualities for individual surfaces of a model.
  4449.  Several such attributes are supported by Irit2Scn and can be set within 
  4450.  {\em IRIT}. See also the ATTRIB {\em IRIT} command.
  4451.    If a certain surface should be finer than the rest of the scene, one can
  4452.  set a "resolution" attribute which specifies the {\em relative} FineNess
  4453.  resolution of this specific surface.
  4454.  Example:
  4455. @\begin{verbatim}
  4456.  attrib( srf1, "resolution", 2 );
  4457. @\end{verbatim}
  4458.  will force srf1 to have twice the default resolution, as set via the '-f'
  4459.  flag.
  4460.    Almost flat patches are converted to polygons. The patch can be converted
  4461.  into two polygons (by subdividing along one of its diagonals) or into four
  4462.  by introducing a new point at the patch center. This behavior is controlled
  4463.  by the '-4' flag, but can be overwritten for individual surfaces bu setting
  4464.  "twoperflat" or "fourperflat".
  4465.    RTrace specific properties are controlled via the following attributes:
  4466.  "SCNrefraction", "SCNtexture", "SCNsurface. Refer to the RTrace manual for
  4467.  their meaning.
  4468.  Example:
  4469. @\begin{verbatim}
  4470.  attrib( srf1, "SCNrefraction", 0.3 );
  4471. @\end{verbatim}
  4472.    Surface color is controlled in two levels. If the object has an RGB
  4473.  attribute, it is used. Otherwise a color as set via {\em IRIT} COLOR command
  4474.  is used if set.
  4475.  Example:
  4476. @\begin{verbatim}
  4477.  attrib( tankBody, "rgb", "244,164,96" );
  4478. @\end{verbatim}
  4479. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4480. @\section{Irit2Xfg - IRIT To XFIG filter}
  4481. !IRIT2Xfg - IRIT To XFIG filter
  4482. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4483. @\subsection{Command Line Options}
  4484. &Command line options
  4485. @\begin{verbatim}
  4486.   irit2xfg [-s Size] [-t XTrans YTrans] [-I #UIso[:#VIso]] [-S #SampPerCrv]
  4487.                                [-M] [-P] [-T] [-i] [-o OutName] [-z] DFiles
  4488. @\end{verbatim}
  4489. @\begin{itemize}
  4490. @\item
  4491.   {\bf -s Size}: Size in inches of the page. Default is 7 inches.
  4492. @\item
  4493.   {\bf -t XTrans YTrans}: X and Y translation. of the image. Default is (0, 0).
  4494. @\item
  4495.   {\bf -I \#UIso[:\#VIso]}: Specifies the number of isolines per surface, per
  4496.         direction. If \#VIso is not specified, \#UIso is used for \#VIso as
  4497.         well.
  4498. @\item
  4499.   {\bf -S \#SampPerCrv}: Specifies the log based 2 of number of samples per
  4500.         (iso)curve.
  4501. @\item
  4502.   {\bf -M}: Dumps the control mesh/polygon as well.
  4503. @\item
  4504.   {\bf -P}: Dumps the curve/surface as isocurves.
  4505. @\item
  4506.   {\bf -T}: Talkative mode. Prints processing information.
  4507. @\item
  4508.   {\bf -i}: Internal edges (created by {\em IRIT}) - default is not to
  4509.        display them, and this option will force displaying them as well.
  4510. @\item
  4511.   {\bf -o OutName}: Name of output file. By default the name of the first data
  4512.        file from {\em DFiles} list is used.  See below on the output files.
  4513. @\item
  4514.   {\bf -z}: Prints version number and current defaults.
  4515. @\end{itemize}
  4516. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4517. @\subsection{Usage}
  4518. &Usage
  4519.     Irit2Xfg converts freeform surfaces and polygons into polylines in a format
  4520.  that can be used by XFIG.
  4521.  Example:
  4522. @\begin{verbatim}
  4523.  irit2Xfg -l -f 15 saddle.dat > saddle.xfg
  4524. @\end{verbatim}
  4525.    However, one can overwrite the viewing matrix by appending a new matrix
  4526.  in the end of the command line, created by the display devices:
  4527. @\begin{verbatim}
  4528.  x11drvs b58.dat
  4529.  irit2Xfg -l -f 5 b58.dat irit.mat > saddle.xfg
  4530. @\end{verbatim}
  4531.  where irit.mat is the viewing matrix created by x11drvs.
  4532. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4533. @\section{Data File Format}
  4534. !DATAFILE Format
  4535.    This section describes the data file format used to exchange data between
  4536.  {\em IRIT} and its accompanying tools.
  4537. @\begin{verbatim}
  4538.  [OBJECT {ATTRS} OBJNAME
  4539.      [NUMBER n]
  4540.    | [VECTOR x y z]
  4541.    | [CTLPT POINT_TYPE {w} x y {z}]
  4542.    | [STRING "a string"]
  4543.    | [MATRIX m00 ... m03
  4544.              m10 ... m13
  4545.              m20 ... m23
  4546.              m30 ... m33]
  4547.      ;A polyline should be drawn from first point to last. Nothing is drawn
  4548.      ;from last to first (in a closed polyline, last point is equal to first).
  4549.    | [POLYLINE {ATTRS} #PTS                   ;#PTS = number of points.
  4550.          [{ATTRS} x y z]
  4551.          [{ATTRS} x y z]
  4552.             .
  4553.             .
  4554.             .
  4555.          [{ATTRS} x y z]
  4556.      ]
  4557.      ;Defines a closed planar region. Last point is NOT equal to first,
  4558.      ;and a line from last point to first should be drawn when the boundary
  4559.      ;of the polygon is drawn.
  4560.    | [POLYGON {ATTRS} #PTS
  4561.          [{ATTRS} x y z]
  4562.          [{ATTRS} x y z]
  4563.             .
  4564.             .
  4565.             .
  4566.          [{ATTRS} x y z]
  4567.      ]
  4568.      ;Defines a "cloud" of points.
  4569.    | [POINTLIST {ATTRS} #PTS
  4570.          [{ATTRS} x y z]
  4571.          [{ATTRS} x y z]
  4572.             .
  4573.             .
  4574.             .
  4575.          [{ATTRS} x y z]
  4576.      ]
  4577.      ;Defines a Bezier curve with #PTS control points. If the curve is
  4578.      ;rational, the rational component is introduced first.
  4579.    | [CURVE BEZIER {ATTRS} #PTS POINT_TYPE
  4580.          [{ATTRS} {w} x y z ...]
  4581.          [{ATTRS} {w} x y z ...]
  4582.             .
  4583.             .
  4584.             .
  4585.          [{ATTRS} {w} x y z ...]
  4586.      ]
  4587.      ;Defines a Bezier surface with #UPTS * #VPTS control points. If the
  4588.      ;surface is rational, the rational component is introduced first.
  4589.      ;Points are printed row after row (#UPTS per row), #VPTS rows.
  4590.    | [SURFACE BEZIER {ATTRS} #UPTS #VPTS POINT_TYPE
  4591.          [{ATTRS} {w} x y z ...]
  4592.          [{ATTRS} {w} x y z ...]
  4593.             .
  4594.             .
  4595.             .
  4596.          [{ATTRS} {w} x y z ...]
  4597.      ]
  4598.      ;Defines a Bspline curve of order ORDER with #PTS control points. If the
  4599.      ;curve is rational, the rational component is introduced first.
  4600.      ;Note length of knot vector is equal to #PTS + ORDER.
  4601.    | [CURVE BSPLINE {ATTRS} #PTS ORDER POINT_TYPE
  4602.          [KV {ATTRS} kv0 kv1 kv2 ...]                    ;Knot vector
  4603.          [{ATTRS} {w} x y z ...]
  4604.          [{ATTRS} {w} x y z ...]
  4605.             .
  4606.             .
  4607.             .
  4608.          [{ATTRS} {w} x y z ...]
  4609.      ]
  4610.      ;Defines a Bspline surface with #UPTS * #VPTS control points, of order
  4611.      ;UORDER by VORDER. If the surface is rational, the rational component
  4612.      ;is introduced first.
  4613.      ;Points are printed row after row (#UPTS per row), #VPTS rows.
  4614.    | [SURFACE BSPLINE {ATTRS} #UPTS #VPTS UORDER VORDER POINT_TYPE
  4615.          [KV {ATTRS} kv0 kv1 kv2 ...]                ;U Knot vector
  4616.          [KV {ATTRS} kv0 kv1 kv2 ...]                ;V Knot vector
  4617.          [{ATTRS} {w} x y z ...]
  4618.          [{ATTRS} {w} x y z ...]
  4619.             .
  4620.             .
  4621.             .
  4622.          [{ATTRS} {w} x y z ...]
  4623.      ]
  4624.  POINT_TYPE -> E1 | E2 | E3 | E4 | E5 | P1 | P2 | P3 | P4 | P5
  4625.  ATTRS -> [ATTRNAME ATTRVALUE]
  4626.           | [ATTRNAME]
  4627.           | [ATTRNAME ATTRVALUE] ATTRS
  4628. @\end{verbatim}
  4629.  Some notes:
  4630.  * This definition for the text file is designed to minimize the
  4631.    reading time and space. All information can be read without backward
  4632.    or forward referencing.
  4633.  * An OBJECT must not hold different geometry or other entities.
  4634.    I.e. CURVEs, SURFACEs, and POLYGONs must all be in different OBJECTs.
  4635.  * Attributes should be ignored if not needed. The attribute list may have
  4636.    any length and is always terminated by a token that is NOT '\verb+[+'. This
  4637.    simplifies and disambiguates the parsing.
  4638.  * Comments may appear between '\verb+[+OBJECT ...\verb+]+' blocks, or
  4639.    immediately after OBJECT OBJNAME, and only there.
  4640.    A comment body can be anything not containing the '\verb+[+' or the
  4641.    '\verb+]+' tokens (signals start/end of block). Some of the comments in
  4642.    the above definition are {\em illegal} and appear there only of the sake
  4643.    of clarity.
  4644.  * It is preferred that geometric attributes such as NORNALs will be saved in
  4645.    the geometry structure level (POLYGON, CURVE or vertices) while graphical
  4646.    and others such as COLORs will be saved in the OBJECT level.
  4647.  * Objects may be contained in other objects to an arbitrary level.
  4648.  Here is an example that exercises most of the data format:
  4649. @\begin{verbatim}
  4650.  This is a legal comment in a data file.
  4651.  [OBJECT DEMO
  4652.      [OBJECT REAL_NUM
  4653.          And this is also a legal comment.
  4654.          [NUMBER 4]
  4655.      ]
  4656.      [OBJECT A_VECTOR
  4657.          [VECTOR 1 2 3]
  4658.      ]
  4659.      [OBJECT CTL_POINT
  4660.          [CTLPT E3 1 2 3]
  4661.      ]
  4662.      [OBJECT STR_OBJ
  4663.          [STRING "string"]
  4664.      ]
  4665.      [OBJECT UNIT_MAT
  4666.          [MATRIX
  4667.             1 0 0 0
  4668.             0 1 0 0
  4669.             0 0 1 0
  4670.             0 0 0 1
  4671.          ]
  4672.      ]
  4673.      [OBJECT [COLOR 4] POLY1OBJ
  4674.          [POLYGON [PLANE 1 0 0 0.5] 4
  4675.              [-0.5 0.5 0.5]
  4676.              [-0.5 -0.5 0.5]
  4677.              [-0.5 -0.5 -0.5]
  4678.              [-0.5 0.5 -0.5]
  4679.          ]
  4680.          [POLYGON [PLANE 0 -1 0 0.5] 4
  4681.              [0.5 0.5 0.5]
  4682.              [-0.5 0.5 0.5]
  4683.              [-0.5 0.5 -0.5]
  4684.              [0.5 0.5 -0.5]
  4685.          ]
  4686.      ]
  4687.      [OBJECT [COLOR 63] ACURVE
  4688.          [CURVE BSPLINE 16 4 E2
  4689.              [KV 0 0 0 0 1 1 1 2 3 4 5 6 7 8 9 10 11 11 11 11]
  4690.              [0.874 0]
  4691.              [0.899333 0.0253333]
  4692.              [0.924667 0.0506667]
  4693.              [0.95 0.076]
  4694.              [0.95 0.76]
  4695.              [0.304 1.52]
  4696.              [0.304 1.9]
  4697.              [0.494 2.09]
  4698.              [0.722 2.242]
  4699.              [0.722 2.318]
  4700.              [0.38 2.508]
  4701.              [0.418 2.698]
  4702.              [0.57 2.812]
  4703.              [0.57 3.42]
  4704.              [0.19 3.572]
  4705.              [0 3.572]
  4706.          ]
  4707.      ]
  4708.      [OBJECT [COLOR 2] SOMESRF
  4709.          [SURFACE BEZIER 3 3 E3
  4710.              [0 0 0]
  4711.              [0.05 0.2 0.1]
  4712.              [0.1 0.05 0.2]
  4713.              [0.1 -0.2 0]
  4714.              [0.15 0.05 0.1]
  4715.              [0.2 -0.1 0.2]
  4716.              [0.2 0 0]
  4717.              [0.25 0.2 0.1]
  4718.              [0.3 0.05 0.2]
  4719.          ]
  4720.      ]
  4721. @\end{verbatim}
  4722. @\section{Bugs and Limitations}
  4723. !BUGS and LIMITATIONS
  4724.    Like any program of more than one line, it is far from being perfect.
  4725.  Some limitations, as well as simplifications, are laid out below.
  4726.  1. If the intersection curve of two objects falls exactly on polygon
  4727.     boundaries, for all polygons, the system will scream that the two objects
  4728.     do not intersect at all. Try to move one by EPSILON into the other.
  4729.     I probably should fix this one - it is supposed to be relatively easy.
  4730.  2. Avoid degenerate intersections that result with a point or a line.
  4731.     They will probably cause wrong propagation of the inner and outer part of
  4732.     one object relative to the other. Always extend your object beyond the
  4733.     other object.
  4734.  3. If two objects have no intersection in their boundary, {\em IRIT} assumes they
  4735.     are disjoint: a union simply combines them, and the other Boolean
  4736.     operators return a NULL object. One should find a FAST way (3D Jordan
  4737.     theorem) to find the relation between the two (A in B, B in A, A
  4738.     disjoint B) and according to that, make a decision.
  4739.  4. Sweep of a circular curve along a circular curve does {\em not} create an
  4740.     exact piece of a torus.
  4741.  5. Since the boolean sum implementation constructs ruled surfaces with
  4742.     uniform speed, it might return a somewhat incorrect answer, given
  4743.     non-uniform input curves.
  4744.  6. The parser is out of hand and is difficult to maintain. There are several
  4745.     memory leaks there that one should fix.
  4746.  7. The X11 driver has no menu support (any easy way to have menus using
  4747.     Xlib!?).
  4748.  8. IBM R6000 fails to run the drivers in -s- mode.
  4749.  9. Rayshade complains a lot about degenerate polygons on irit2ray output.
  4750.     To alleviate the problem, change the 'equal' macro in common.h in libcommon
  4751.     of rayshade from EPSILON (1e-5) to 1e-7 or even lower.
  4752. @\end{document}
  4753.